diff options
author | K900 <me@0upti.me> | 2024-04-05 08:56:21 +0300 |
---|---|---|
committer | K900 <me@0upti.me> | 2024-04-05 09:00:12 +0300 |
commit | 15d95c7b7451d3bfa2fec0389c02f3e8a9c35f60 (patch) | |
tree | aa50fa95606da620e962bd846a7a7d2cd14a4960 /nixos | |
parent | 7b602cff5c260ec98497253417ef17fffa1a0692 (diff) |
nixos/qemu-vm: split up the "keep EFI variables from system image" logic
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 9 | ||||
-rw-r--r-- | nixos/tests/installer.nix | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 6f45c9b657c89..a8e5db4f8a5ba 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -186,7 +186,7 @@ let NIX_EFI_VARS=$(readlink -f "''${NIX_EFI_VARS:-${config.system.name}-efi-vars.fd}") # VM needs writable EFI vars if ! test -e "$NIX_EFI_VARS"; then - ${if cfg.useBootLoader && cfg.useDefaultFilesystems then + ${if cfg.efi.keepVariables then # We still need the EFI var from the make-disk-image derivation # because our "switch-to-configuration" process might # write into it and we want to keep this data. @@ -905,6 +905,13 @@ in Defaults to OVMF. ''; }; + + keepVariables = mkOption { + type = types.bool; + default = cfg.useBootLoader; + defaultText = literalExpression "cfg.useBootLoader"; + description = "Whether to keep EFI variable values from the generated system image"; + }; }; virtualisation.tpm = { diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index 965e8a1ef5b81..7e835041eb39f 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -513,6 +513,7 @@ let virtualisation.useBootLoader = true; virtualisation.useEFIBoot = isEfi; virtualisation.useDefaultFilesystems = false; + virtualisation.efi.keepVariables = false; virtualisation.fileSystems."/" = { device = "/dev/disk/by-label/this-is-not-real-and-will-never-be-used"; |