75f6cd20da
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'. I added a new bootloader configuration for nixos, generationsDir. It creates /boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations in /boot/system-$gen/{init,initrd,kernel,system}. I can program the u-boot loader to load /boot/default files always, and have a minimal nixos boot loader installer functionality. Additionally, I can refer to the other system generations easily, with a simple 'ls' in /boot. svn path=/nixos/trunk/; revision=17460
60 lines
1.2 KiB
Nix
60 lines
1.2 KiB
Nix
{pkgs, config, ...}:
|
|
|
|
###### interface
|
|
let
|
|
inherit (pkgs.lib) mkOption mkIf;
|
|
|
|
options = {
|
|
boot = {
|
|
loader = {
|
|
generationsDir = {
|
|
|
|
enable = mkOption {
|
|
default = false;
|
|
description = ''
|
|
Whether to enable the simple preparation of symlinks to the system
|
|
generations in /boot.
|
|
'';
|
|
};
|
|
|
|
copyKernels = mkOption {
|
|
default = false;
|
|
description = "
|
|
Whether copy the necessary boot files into /boot, so
|
|
/nix/store is not needed by the boot loadear.
|
|
";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
in
|
|
|
|
###### implementation
|
|
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
|
|
{
|
|
require = [
|
|
options
|
|
|
|
# config.system.build
|
|
# ../system/system-options.nix
|
|
];
|
|
|
|
system = mkIf config.boot.loader.generationsDir.enable {
|
|
build = {
|
|
menuBuilder = generationsDirBuilder;
|
|
};
|
|
boot.loader.id = "generationsDir";
|
|
boot.loader.kernelFile = "uImage";
|
|
};
|
|
}
|