diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2017-04-04 22:50:48 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2017-04-05 09:05:13 +0200 |
commit | a5ad8b4f69d541f1b8e456eb5d405b1558df9885 (patch) | |
tree | 5818bb66d090abd46bdb4f84cfe76e2228c4bb99 /nixos/modules/system | |
parent | 527512e5549c237010be421b14535c95f4f907ba (diff) |
stage-2: simplify exporting path
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/stage-2-init.sh | 17 | ||||
-rw-r--r-- | nixos/modules/system/boot/stage-2.nix | 10 |
2 files changed, 6 insertions, 21 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh index f827e530f877a..99930fb95a61a 100644 --- a/nixos/modules/system/boot/stage-2-init.sh +++ b/nixos/modules/system/boot/stage-2-init.sh @@ -2,7 +2,7 @@ systemConfig=@systemConfig@ -export HOME=/root +export HOME=/root PATH="@path@" # Print a greeting. @@ -11,21 +11,6 @@ echo -e "\e[1;32m<<< NixOS Stage 2 >>>\e[0m" echo -# Set the PATH. -setPath() { - local dirs="$1" - export PATH=/empty - for i in $dirs; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi - done -} - -setPath "@path@" - - # Normally, stage 1 mounts the root filesystem read/writable. # However, in some environments, stage 2 is executed directly, and the # root is read-only. So make it writable here. diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index 7e4ec2a4a6703..a6864bf80c30c 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -23,11 +23,11 @@ let inherit (config.nix) readOnlyStore; inherit (config.networking) useHostResolvConf; inherit (config.system.build) earlyMountScript; - path = - [ pkgs.coreutils - pkgs.utillinux - pkgs.openresolv - ] ++ optional config.nix.readOnlyStore readonlyMountpoint; + path = lib.makeBinPath ([ + pkgs.coreutils + pkgs.utillinux + pkgs.openresolv + ] ++ optional config.nix.readOnlyStore readonlyMountpoint); postBootCommands = pkgs.writeText "local-cmds" '' ${config.boot.postBootCommands} |