Change:
I sometimes create a qemu VM in libvirt in "session mode", meaning that the libvirt daemon is running as my non-root user, and the system-wide libvirtd does not need to be running (). This VM has a network bridge, which libvirt apparently creates by calling , which in turn uses . The problem is that doesn't get fully populated until the system libvirtd gets started. Previously, in nixpkgs (from February), this wasn't noticeable because libvirtd.service was WantedBy libvirt-guests.service (which is WantedBy multi-), so libvirtd would always be started on boot to populate that directory. Now, with , this is no longer the case, and libvirtd.service does not get started (presumably, if libvirt-guests.service actually needed to start a VM, then libvirtd.service would be socket-activated, but for me this is not the case). As a result, doesn't get populated and my session-mode libvirt can't find . python: The VM's XML file defines a network bridge, which is why gets involved. the following output: The libvirt user session should be usable without first starting the system-wide libvirtd. If you start (and optionally stop) the system libvirtd.service before following the steps to reproduce, everything works fine, because the directory gets populated. Probably, should be put somewhere else, where session-mode daemons can use it without needing to have previously started system-mode libvirtd. (The same may be true of other stuff in too.) libvirt maintainers: Okay, but I'm using flakes and that channel looks old. See relevant commit hashes above.
Oof, happy to find this, it would have taken me a long time to figure out I needed to run first. Can't the sudo wrapper point to the file in the nix store?

Discussion:
setuid = true; owner = "root"; group = "root"; <del> source = "/run/${dirName}/nix-helpers/qemu-bridge-helper"; </del> <ins> source = "${cfg.qemu.package}/libexec/qemu-bridge-helper"; </ins> }; systemd.packages = [ cfg.package ];

ln -s --force "$emulator" /run/${dirName}/nix-emulators/ done <del> for helper in libexec/qemu-bridge-helper bin/qemu-pr-helper; do </del> <ins> for helper in bin/qemu-pr-helper; do </ins> ln -s --force ${cfg.qemu.package}/$helper /run/${dirName}/nix-helpers/ done

libreswan = handleTest ./libreswan.nix {}; librewolf = handleTest ./firefox.nix { firefoxPackage = pkgs.librewolf; }; libuiohook = handleTest ./libuiohook.nix {}; <ins> libvirtd = handleTest ./libvirtd.nix {}; </ins> lidarr = handleTest ./lidarr.nix {}; lightdm = handleTest ./lightdm.nix {}; lighttpd = handleTest ./lighttpd.nix {};

<ins> import ./make-test-python.nix ({ pkgs, ... }: { name = "libvirtd"; meta.maintainers = with pkgs.lib.maintainers; [ fpletz ]; nodes = { virthost = { pkgs, ... }: { virtualisation = { cores = 2; memorySize = 2048; libvirtd.enable = true; }; networking.nameservers = [ "192.168.122.1" ]; security.polkit.enable = true; environment.systemPackages = with pkgs; [ virt-manager ]; }; }; testScript = let nixosInstallISO = (import ../release.nix {}).iso_minimal.${pkgs.hostPlatform.system}; virshShutdownCmd = if pkgs.stdenv.isx86_64 then "shutdown" else "destroy"; in '' start_all() virthost.wait_for_unit("sockets.target") with subtest("enable default network"): virthost.succeed("virsh net-start default") virthost.succeed("virsh net-autostart default") virthost.succeed("virsh net-info default") with subtest("check if partition disk pools works with parted"): virthost.succeed("fallocate -l100m /tmp/foo; losetup /dev/loop0 /tmp/foo; echo 'label: dos' | sfdisk /dev/loop0") virthost.succeed("virsh pool-create-as foo disk --source-dev /dev/loop0 --target /dev") virthost.succeed("virsh vol-create-as foo loop0p1 25MB") virthost.succeed("virsh vol-create-as foo loop0p2 50MB") with subtest("check if nixos install iso boots and network works"): virthost.succeed( "virt-install -n nixos --osinfo=nixos-unstable --ram=1024 --graphics=none --disk=`find ${nixosInstallISO}/iso -type f | head -n1`,readonly=on --import --noautoconsole" ) virthost.succeed("virsh domstate nixos | grep running") virthost.wait_until_succeeds("ping -c 1 nixos") virthost.succeed("virsh ${virshShutdownCmd} nixos") virthost.wait_until_succeeds("virsh domstate nixos | grep 'shut off'") ''; }) </ins>

, xhtml1 , yajl , writeScript <ins> , nixosTests </ins> # Linux , acl ? null

# NOTE: You must also bump: # <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> # SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix> <del> version = "8.5.0"; </del> <ins> version = "8.6.0"; </ins> src = fetchFromGitLab { owner = pname; repo = pname; rev = "v${version}"; <del> sha256 = "sha256-x6TnMFYjcUSdQZd9ctN2hITCAl9TGVb7/qAObGb9xMk="; </del> <ins> sha256 = "sha256-bSId7G2o808WfHGt5ioFEIhPyy4+XW+R349UgHKOvQU="; </ins> fetchSubmodules = true; };

sed -i '/virnetsockettest/d' tests/meson.build # delete only the first occurrence of this sed -i '0,/qemuxml2argvtest/{/qemuxml2argvtest/d;}' tests/meson.build <ins> '' + optionalString isLinux '' sed -i 's,define PARTED "parted",define PARTED "${parted}/bin/parted",'  src/storage/storage_backend_disk.c  src/storage/storage_util.c </ins> '' + optionalString isDarwin '' sed -i '/qemucapabilitiestest/d' tests/meson.build sed -i '/vircryptotest/d' tests/meson.build

update-source-version perlPackages.SysVirt "$sysvirtVersion" --file="pkgs/top-level/perl-packages.nix" ''; <ins> passthru.tests.libvirtd = nixosTests.libvirtd; </ins> meta = { homepage = "https://libvirt.org/"; description = ''

buildPythonPackage rec { pname = "libvirt"; <del> version = "8.5.0"; </del> <ins> version = "8.6.0"; </ins> src = fetchFromGitLab { owner = "libvirt"; repo = "libvirt-python"; rev = "v${version}"; <del> sha256 = "sha256-/OS+qBo0h9jshKDuxKX++cRPAjegImQROb7Uh+imOUA="; </del> <ins> sha256 = "sha256-eJ0RPxJ4Gm+VGs6NeTWP2FbvDnJy4mURPlFbgvkSgo0="; </ins> }; nativeBuildInputs = [ pkg-config ];

SysVirt = buildPerlModule rec { pname = "Sys-Virt"; <del> version = "8.4.0"; </del> <ins> version = "8.5.0"; </ins> src = fetchFromGitLab { owner = "libvirt"; repo = "libvirt-perl"; rev = "v${version}"; <del> sha256 = "sha256-nw9KG3dO0Oxre2NVp+4Z+kgIluU5j1xOu8grZJRXhik="; </del> <ins> sha256 = "sha256-VuM4rPrG15vXnF5e1MBSGB76zLI+8nkSiJmwWg8aJgE="; </ins> }; nativeBuildInputs = [ pkgs.pkg-config ]; buildInputs = [ pkgs.libvirt CPANChanges TestPod TestPodCoverage XMLXPath ];