mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 06:01:15 +00:00
72d906a0ea
(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
81 lines
2.5 KiB
Nix
81 lines
2.5 KiB
Nix
# Experimental flake interface to Nixpkgs.
|
|
# See https://github.com/NixOS/rfcs/pull/49 for details.
|
|
{
|
|
description = "A collection of packages for the Nix package manager";
|
|
|
|
outputs = { self }:
|
|
let
|
|
jobs = import ./pkgs/top-level/release.nix {
|
|
nixpkgs = self;
|
|
};
|
|
|
|
lib = import ./lib;
|
|
|
|
systems = [
|
|
"x86_64-linux"
|
|
"i686-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-linux"
|
|
"armv6l-linux"
|
|
"armv7l-linux"
|
|
];
|
|
|
|
forAllSystems = f: lib.genAttrs systems (system: f system);
|
|
|
|
in
|
|
{
|
|
lib = lib.extend (final: prev: {
|
|
nixosSystem = { modules, ... } @ args:
|
|
import ./nixos/lib/eval-config.nix (args // {
|
|
modules =
|
|
let
|
|
vmConfig = (import ./nixos/lib/eval-config.nix
|
|
(args // {
|
|
modules = modules ++ [ ./nixos/modules/virtualisation/qemu-vm.nix ];
|
|
})).config;
|
|
|
|
vmWithBootLoaderConfig = (import ./nixos/lib/eval-config.nix
|
|
(args // {
|
|
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
|
|
modules ++ [
|
|
{
|
|
system.nixos.versionSuffix =
|
|
".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
|
|
system.nixos.revision = final.mkIf (self ? rev) self.rev;
|
|
|
|
system.build = {
|
|
vm = vmConfig.system.build.vm;
|
|
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
|
|
};
|
|
}
|
|
];
|
|
});
|
|
});
|
|
|
|
checks.x86_64-linux.tarball = jobs.tarball;
|
|
|
|
htmlDocs = {
|
|
nixpkgsManual = jobs.manual;
|
|
nixosManual = (import ./nixos/release-small.nix {
|
|
nixpkgs = self;
|
|
}).nixos.manual.x86_64-linux;
|
|
};
|
|
|
|
legacyPackages = forAllSystems (system: import ./. { inherit system; });
|
|
|
|
nixosModules = {
|
|
notDetected = import ./nixos/modules/installer/scan/not-detected.nix;
|
|
};
|
|
};
|
|
}
|