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.
This commit is contained in:
Bjørn Forsman 2017-07-14 17:22:59 +02:00
parent 292827b0e0
commit b8e109d6ac

View File

@ -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
''; # */