Hello everyone.
I made the switch from Debian to NixOS recently. I am a big fan of the ethos and the goal and I want to learn how to use it and contribute to writing documentation and tutorials on my blog. I have finished said blog but want to do some infrastructure preparation for deploying it.
I am going to host my blog on a RaspberryPi 5 SBC. Unfortunately I can’t put on NixOS on it, otherwise I would not need to do what I am trying to do now. What I am trying to do now is use Ansible to do automatic provisioning in case I install a routine update that bricks my RP 5 again.
I have enabled virt-manager as per the link here and also did the libvirt setup as per the link here. I created a nix-shell as shown below:
{
description = "A development environment for running Ansible and libvirt";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
pythonWithLibvirt = pkgs.python3.withPackages(ps: [
ps.libvirt # Add the libvirt Python bindings here
]);
in
{
devShells.default = pkgs.mkShell {
name = "ansible-shell";
# Packages whose binaries you want available on your PATH.
packages = with pkgs; [
ansible
pythonWithLibvirt
];
};
}
);
}
When I do the task list_vms
from the Ansible libvirt module, I get the below error:
“msg”: “libvirtError: Cannot check QEMU binary /usr/bin/qemu-system-x86_64: No such file or directory”
I have been trying to use AI, dive into the code bases and try stuff for a week and can’t figure it out.
I have found that the error is thrown here but I don’t know how to explore C code bases and don’t know how the binary variable is set there.
The executable qemu-system-x86_64 is in the PATH both inside the shell and outside the shell.
I have also tryied running the command virsh -c qemu:///system list --all
. That runs with no problem at all.
Any help would be appreciated. Thank you for your attention.