diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index 5d0ac24be6f..5de8135867a 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -1,27 +1,51 @@ -{ substituteAll, writeText, coreutils -, utillinux, kernel, udev, upstart -, activateConfiguration +{pkgs, config, ...}: -, # Whether the root device is read-only and should be made writable - # through a unionfs. - isLiveCD +let + inherit (pkgs) substituteAll writeText coreutils utillinux udev upstart; + kernel = config.boot.kernelPackages.kernel; + activateConfiguration = config.system.activationScripts.script; + inherit (config.boot) isLiveCD; -, # Path for Upstart jobs. Should be quite minimal. - upstartPath - -, # User-supplied command to be run just before Upstart is started. - bootLocal ? "" -}: - -substituteAll { - src = ./boot-stage-2-init.sh; - isExecutable = true; - inherit kernel upstart isLiveCD activateConfiguration upstartPath; - path = [ - coreutils - utillinux - udev - upstart + # Path for Upstart jobs. Should be quite minimal. + upstartPath = [ + pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + pkgs.upstart ]; - bootLocal = writeText "local-cmds" bootLocal; + + bootLocal = config.boot.localCommands; + + bootStage2 = substituteAll { + src = ./boot-stage-2-init.sh; + isExecutable = true; + inherit kernel upstart isLiveCD activateConfiguration upstartPath; + path = [ + coreutils + utillinux + udev + upstart + ]; + bootLocal = writeText "local-cmds" bootLocal; + }; +in + +{ + require = [ + # config.boot.localCommands + # config.boot.kernelPackages + + # config.system.activationScripts + (import ../system/activate-configuration.nix) + + # config.system.build + (import ../system/system-options.nix) + ]; + + system = { + build = { + inherit bootStage2; + }; + }; } diff --git a/system/options.nix b/system/options.nix index ba3366ec5b0..c52a2327463 100644 --- a/system/options.nix +++ b/system/options.nix @@ -2507,6 +2507,9 @@ in }; require = [ + # boot (is it the right place ?) + (import ../boot/boot-stage-2.nix) + # system (import ../system/system-options.nix) (import ../system/activate-configuration.nix) diff --git a/system/system.nix b/system/system.nix index e6dc5c6d53e..8271b97371c 100644 --- a/system/system.nix +++ b/system/system.nix @@ -191,20 +191,7 @@ rec { # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. - bootStage2 = import ../boot/boot-stage-2.nix { - inherit (pkgs) substituteAll writeText coreutils - utillinux udev upstart; - inherit kernel activateConfiguration; - inherit (config.boot) isLiveCD; - upstartPath = [ - pkgs.coreutils - pkgs.findutils - pkgs.gnugrep - pkgs.gnused - pkgs.upstart - ]; - bootLocal = config.boot.localCommands; - }; + bootStage2 = config.system.build.bootStage2; # Script to build the Grub menu containing the current and previous