From b8e109d6acf61df5c02825f5b485239649f4ea31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Fri, 14 Jul 2017 17:22:59 +0200 Subject: [PATCH] nixos/libvirt: prevent OVMF path from being garbage collected Use xmlstarlet to update the OVMF path on each startup, like we do for ...qemu-kvm. A libvirt domain using UEFI cannot start if the OVMF path is garbage collected/missing. --- nixos/modules/virtualisation/libvirtd.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index c8742b27c6d..b24ea0f33c9 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 ''; # */