diff options
Diffstat (limited to 'modules/system/boot/loader')
-rw-r--r-- | modules/system/boot/loader/generations-dir/generations-dir.nix | 95 | ||||
-rw-r--r-- | modules/system/boot/loader/raspberrypi/raspberrypi.nix | 53 |
2 files changed, 64 insertions, 84 deletions
diff --git a/modules/system/boot/loader/generations-dir/generations-dir.nix b/modules/system/boot/loader/generations-dir/generations-dir.nix index b14f81552ee..9855c8c19dd 100644 --- a/modules/system/boot/loader/generations-dir/generations-dir.nix +++ b/modules/system/boot/loader/generations-dir/generations-dir.nix @@ -1,48 +1,9 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: -###### interface -let - inherit (pkgs.lib) mkOption mkIf; - - options = { - boot = { - loader = { - generationsDir = { - - enable = mkOption { - default = false; - 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; - description = " - Whether copy the necessary boot files into /boot, so - /nix/store is not needed by the boot loader. - "; - }; - }; - }; - }; - }; +with pkgs.lib; -in - -###### implementation let + generationsDirBuilder = pkgs.substituteAll { src = ./generations-dir-builder.sh; isExecutable = true; @@ -53,18 +14,50 @@ let # Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk platform = pkgs.stdenv.platform; + in + { - require = [ - options + options = { + + boot.loader.generationsDir = { + + enable = mkOption { + default = false; + 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; + 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 { - # config.system.build - # ../system/system-options.nix - ]; + system.build.installBootLoader = generationsDirBuilder; + system.boot.loader.id = "generationsDir"; + system.boot.loader.kernelFile = platform.kernelTarget; - system = mkIf config.boot.loader.generationsDir.enable { - build.installBootLoader = generationsDirBuilder; - boot.loader.id = "generationsDir"; - boot.loader.kernelFile = platform.kernelTarget; }; } diff --git a/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/modules/system/boot/loader/raspberrypi/raspberrypi.nix index f083a002b42..5bc856c3df0 100644 --- a/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ b/modules/system/boot/loader/raspberrypi/raspberrypi.nix @@ -1,30 +1,9 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: -###### interface -let - inherit (pkgs.lib) mkOption mkIf; - - options = { - boot = { - loader = { - raspberryPi = { - enable = mkOption { - default = false; - description = '' - Whether to create files with the system generations in - <literal>/boot</literal>. - <literal>/boot/old</literal> will hold files from old generations. - ''; - }; - }; - }; - }; - }; - -in +with pkgs.lib; -###### implementation let + builder = pkgs.substituteAll { src = ./builder.sh; isExecutable = true; @@ -34,18 +13,26 @@ let }; platform = pkgs.stdenv.platform; + in + { - require = [ - options + options = { - # config.system.build - # ../system/system-options.nix - ]; + boot.loader.raspberryPi.enable = mkOption { + default = false; + description = '' + Whether to create files with the system generations in + <literal>/boot</literal>. + <literal>/boot/old</literal> will hold files from old generations. + ''; + }; + + }; - system = mkIf config.boot.loader.raspberryPi.enable { - build.installBootLoader = builder; - boot.loader.id = "raspberrypi"; - boot.loader.kernelFile = platform.kernelTarget; + config = mkIf config.boot.loader.raspberryPi.enable { + system.build.installBootLoader = builder; + system.boot.loader.id = "raspberrypi"; + system.boot.loader.kernelFile = platform.kernelTarget; }; } |