libvirt: Fix broken when Kernel differs b/w current- and booted-system

Libvirt checks this path + $(uname -r), which is the running Kernel.
current-system does not necessarily contain the running Kernel, but
booted-system does.

Broken in ad78ce7764, which ignored the
discussion in https://github.com/NixOS/nixpkgs/pull/286330. It is still
broken on non-NixOS Linux.
This commit is contained in:
Andrew Marshall 2024-02-09 13:23:33 -05:00
parent 61950db5f8
commit df966328e0

View File

@ -251,7 +251,7 @@ stdenv.mkDerivation rec {
--replace '"/usr/bin/pkttyagent"' '"${if isLinux then polkit.bin else "/usr"}/bin/pkttyagent"'
substituteInPlace src/util/virpci.c \
--replace '/lib/modules' '${if isLinux then "/run/current-system/kernel-modules" else ""}/lib/modules'
--replace '/lib/modules' '${if isLinux then "/run/booted-system/kernel-modules" else ""}/lib/modules'
patchShebangs .
''