63b02e55db
Thanks @ajs124 in https://github.com/NixOS/nixpkgs/pull/110544#discussion_r563828722 for catching this. According to: git grep 'inherit.*Platform.*platform' git grep ' linux-kernel' We now don't have any remaining problems of this sort, thankfully.
62 lines
1.6 KiB
Nix
62 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
generationsDirBuilder = pkgs.substituteAll {
|
|
src = ./generations-dir-builder.sh;
|
|
isExecutable = true;
|
|
inherit (pkgs) bash;
|
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
|
inherit (config.boot.loader.generationsDir) copyKernels;
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
|
|
boot.loader.generationsDir = {
|
|
|
|
enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = ''
|
|
Whether to create symlinks to the system generations under
|
|
<literal>/boot</literal>. When enabled,
|
|
<literal>/boot/default/kernel</literal>,
|
|
<literal>/boot/default/initrd</literal>, etc., are updated to
|
|
point to the current generation's kernel image, initial RAM
|
|
disk, and other bootstrap files.
|
|
|
|
This optional is not necessary with boot loaders such as GNU GRUB
|
|
for which the menu is updated to point to the latest bootstrap
|
|
files. However, it is needed for U-Boot on platforms where the
|
|
boot command line is stored in flash memory rather than in a
|
|
menu file.
|
|
'';
|
|
};
|
|
|
|
copyKernels = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = ''
|
|
Whether copy the necessary boot files into /boot, so
|
|
/nix/store is not needed by the boot loader.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
config = mkIf config.boot.loader.generationsDir.enable {
|
|
|
|
system.build.installBootLoader = generationsDirBuilder;
|
|
system.boot.loader.id = "generationsDir";
|
|
system.boot.loader.kernelFile = pkgs.stdenv.hostPlatform.linux-kernel.target;
|
|
|
|
};
|
|
}
|