nixpkgs/nixos
Bjørn Forsman 72d906a0ea 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
2021-01-08 19:36:10 +01:00
..
doc Merge pull request #97740 from ju1m/tor 2021-01-05 16:00:40 +00:00
lib Merge pull request #104292 from fgaz/image-contents 2020-12-21 19:58:49 +01:00
maintainers Merge pull request #102174 from grahamc/ami-root-use-gpt 2020-10-30 16:14:37 -04:00
modules nixos/getty: add services.getty.loginOptions 2021-01-08 13:55:25 +00:00
tests Merge pull request #97740 from ju1m/tor 2021-01-05 16:00:40 +00:00
COPYING Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
default.nix nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems 2021-01-08 19:36:10 +01:00
README treewide: use https for nixos.org and hydra.nixos.org 2020-05-03 22:14:21 -07:00
release-combined.nix release-combined: Add shadow test 2020-12-23 13:28:52 -05:00
release-small.nix Merge pull request #104322 from grahamc/amazon-image 2020-11-19 18:45:07 -05:00
release.nix nixos/release: add pantheon closure 2020-07-26 15:30:08 -04:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
https://nixos.org/nixos and in the manual in doc/manual.