use tmpfile.d to symlink vfio things

This commit is contained in:
Gerg-L 2023-02-22 17:58:29 -05:00
parent 7bc746dbd1
commit d911aabfad
2 changed files with 6 additions and 11 deletions

View file

@ -36,7 +36,7 @@ _: {
users.users."${settings.username}".extraGroups = ["kvm" "libvirtd"];
systemd.services.libvirtd.preStart = let
systemd.tmpfiles.rules = let
xml = pkgs.writeText "Windows.xml" (builtins.readFile "${self}/misc/Windows.xml");
qemuHook = pkgs.writeScript "qemu-hook" ''
#!${pkgs.stdenv.shell}
@ -58,14 +58,8 @@ _: {
fi
fi
'';
in ''
mkdir -p /var/lib/libvirt/hooks
chmod 755 /var/lib/libvirt/hooks
# Copy hook files
ln -sf ${qemuHook} /var/lib/libvirt/hooks/qemu
mkdir -p /var/lib/libvirt/qemu/
ln -sf ${xml} /var/lib/libvirt/qemu/Windows.xml
'';
in [
"L+ /var/lib/libvirt/hooks/ - - - - ${qemuHook}"
"L+ /var/lib/libvirt/qemu/Windows.xml - - - - ${xml}"
];
}