diff --git a/tools/test-install.sh b/tools/test-install.sh index b618ac8..0dcb3eb 100755 --- a/tools/test-install.sh +++ b/tools/test-install.sh @@ -63,12 +63,21 @@ if df --output=fstype "$TARGET_DIR" | tail -1 | grep -q tmpfs; then fi OVMF="${NOMARCHY_OVMF:-}" -[ -n "$OVMF" ] || for c in /run/current-system/sw/share/qemu/edk2-x86_64-code.fd \ - /run/current-system/sw/share/OVMF/OVMF_CODE.fd \ - /usr/share/OVMF/OVMF_CODE.fd; do - [ -f "$c" ] && { OVMF="$c"; break; } -done -[ -n "$OVMF" ] || { echo "no OVMF firmware found" >&2; exit 1; } +if [ -z "$OVMF" ]; then + for c in /run/current-system/sw/share/qemu/edk2-x86_64-code.fd \ + /run/current-system/sw/share/OVMF/OVMF_CODE.fd \ + /usr/share/OVMF/OVMF_CODE.fd; do + [ -f "$c" ] && { OVMF="$c"; break; } + done +fi +# Fall back to nixpkgs OVMF.fd (FV/OVMF_CODE.fd) when not on the host profile. +if [ -z "$OVMF" ] || [ ! -f "$OVMF" ]; then + ovmf_store=$(nix build --no-link --print-out-paths nixpkgs#OVMF.fd 2>/dev/null || true) + for c in "$ovmf_store"/FV/OVMF_CODE.fd "$ovmf_store"/FV/OVMF.fd; do + [ -f "$c" ] && { OVMF="$c"; break; } + done +fi +[ -n "$OVMF" ] && [ -f "$OVMF" ] || { echo "no OVMF firmware found (set NOMARCHY_OVMF=…)" >&2; exit 1; } echo "==> Building the live ISO..." nix build .#nixosConfigurations.nomarchy-live.config.system.build.isoImage