summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2021-01-05 20:29:52 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2021-01-08 19:36:10 +0100
commit72d906a0eafd089c90a6daab24ef344a79b00046 (patch)
tree1387bf028240950c200232734724e364d1d63cfc /nixos
parent40842049e8b883b5c218fb3a813d6a6b85dc3615 (diff)
nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems
(The first version of this change, in commit 39fad297fd, broke `nix-build -A nixosTests.installer.simpleUefiSystemdBoot`. This is the 2nd version, which hopefully does not break anything.) `nixos-rebuild build-vm-with-bootloader` currently fails with the default NixOS EFI configuration: $ cat >configuration.nix <<EOF { fileSystems."/".device = "/dev/sda1"; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; } EOF $ nixos-rebuild build-vm-with-bootloader -I nixos-config=$PWD/configuration.nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz [...] insmod: ERROR: could not insert module /nix/store/1ibmgfr13r8b6xyn4f0wj115819f359c-linux-5.4.83/lib/modules/5.4.83/kernel/fs/efivarfs/efivarfs.ko.xz: No such device mount: /sys/firmware/efi/efivars: mount point does not exist. [ 1.908328] reboot: Power down builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 32 [...] Fix it by setting virtualisation.useEFIBoot = true when needed. Before: * release-20.03: successful build, unsuccessful run * release-20.09 (and master): unsuccessful build After: * Successful build and run. Fixes #107255
Diffstat (limited to 'nixos')
-rw-r--r--nixos/default.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/default.nix b/nixos/default.nix
index 45da78e9261c..c11872f1441a 100644
--- a/nixos/default.nix
+++ b/nixos/default.nix
@@ -22,6 +22,11 @@ let
[ configuration
./modules/virtualisation/qemu-vm.nix
{ virtualisation.useBootLoader = true; }
+ ({ config, ... }: {
+ virtualisation.useEFIBoot =
+ config.boot.loader.systemd-boot.enable ||
+ config.boot.loader.efi.canTouchEfiVariables;
+ })
];
}).config;