Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2829500ac2bd
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 91488173319e
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jan 10, 2021

  1. nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems

    (The first version of this change, in commit 39fad29, 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
    
    (cherry picked from commit 72d906a)
    bjornfor committed Jan 10, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    tfmoraes Thiago Franco de Moraes
    Copy the full SHA
    9148817 View commit details
Showing with 10 additions and 0 deletions.
  1. +5 −0 flake.nix
  2. +5 −0 nixos/default.nix
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -39,6 +39,11 @@
modules = modules ++ [
./nixos/modules/virtualisation/qemu-vm.nix
{ virtualisation.useBootLoader = true; }
({ config, ... }: {
virtualisation.useEFIBoot =
config.boot.loader.systemd-boot.enable ||
config.boot.loader.efi.canTouchEfiVariables;
})
];
})).config;
in
5 changes: 5 additions & 0 deletions nixos/default.nix
Original file line number Diff line number Diff line change
@@ -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;