diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index 64f788993fe6..49d1e5e24a3e 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -85,4 +85,12 @@ in } ]; }; + + # After booting, register the contents of the Nix store on the CD in + # the Nix database in the tmpfs. + boot.postBootCommands = + '' + ${config.environment.nix}/bin/nix-store --load-db < /nix-path-registration + rm /nix-path-registration + ''; } diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 121cf46e12a4..f8cd3e913c30 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -131,7 +131,7 @@ export MODULE_DIR=@kernel@/lib/modules/ # Run any user-specified commands. -@shell@ @bootLocal@ +@shell@ @postBootCommands@ # Start Upstart's init. We start it through the diff --git a/modules/system/boot/stage-2.nix b/modules/system/boot/stage-2.nix index f0e90452ebe5..440ff70965f2 100644 --- a/modules/system/boot/stage-2.nix +++ b/modules/system/boot/stage-2.nix @@ -4,12 +4,13 @@ let options = { - boot.localCommands = pkgs.lib.mkOption { + boot.postBootCommands = pkgs.lib.mkOption { default = ""; - example = "text=anything; echo You can put $text here."; - description = " + example = "rm -f /var/log/messages"; + merge = pkgs.lib.mergeStringOption; + description = '' Shell commands to be executed just before Upstart is started. - "; + ''; }; }; @@ -19,28 +20,27 @@ let activateConfiguration = config.system.activationScripts.script; # Path for Upstart jobs. Should be quite minimal. - upstartPath = [ - pkgs.coreutils - pkgs.findutils - pkgs.gnugrep - pkgs.gnused - pkgs.upstart - ]; - - bootLocal = config.boot.localCommands; + upstartPath = + [ pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + pkgs.upstart + ]; bootStage2 = substituteAll { src = ./stage-2-init.sh; isExecutable = true; inherit kernel upstart activateConfiguration upstartPath; - path = [ - coreutils - utillinux - udev - upstart - ]; - bootLocal = writeText "local-cmds" bootLocal; + path = + [ coreutils + utillinux + udev + upstart + ]; + postBootCommands = writeText "local-cmds" config.boot.postBootCommands; }; + in {