about summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2017-07-14 17:22:59 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-07-14 22:07:57 +0200
commitb8e109d6acf61df5c02825f5b485239649f4ea31 (patch)
tree0851ec009abe1cefd10c6cc3e845e83e19420215 /nixos/modules/virtualisation
parent292827b0e0a52312a1abe67bfc8baa44afd04e27 (diff)
downloadnixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar.gz
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar.bz2
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar.lz
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar.xz
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.tar.zst
nixlib-b8e109d6acf61df5c02825f5b485239649f4ea31.zip
nixos/libvirt: prevent OVMF path from being garbage collected
Use xmlstarlet to update the OVMF path on each startup, like we do for
<emulator>...qemu-kvm</emulator>.

A libvirt domain using UEFI cannot start if the OVMF path is garbage
collected/missing.
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/libvirtd.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index c8742b27c6d5..b24ea0f33c9e 100644
--- a/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixos/modules/virtualisation/libvirtd.nix
@@ -167,6 +167,9 @@ in {
             new_emulator=$(PATH=${pkgs.libvirt}/libexec:$PATH command -v $(basename "$emulator"))
             # write back
             "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/devices/emulator" -v "$new_emulator" "$file"
+
+            # Also refresh the OVMF path. Files with no matches are ignored.
+            "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/os/loader" -v "${pkgs.OVMF.fd}/FV/OVMF_CODE.fd" "$file"
         done
       ''; # */