summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-04-04 22:50:48 +0200
committerJörg Thalheim <joerg@thalheim.io>2017-04-05 09:05:13 +0200
commita5ad8b4f69d541f1b8e456eb5d405b1558df9885 (patch)
tree5818bb66d090abd46bdb4f84cfe76e2228c4bb99
parent527512e5549c237010be421b14535c95f4f907ba (diff)
downloadnixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar.gz
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar.bz2
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar.lz
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar.xz
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.tar.zst
nixpkgs-a5ad8b4f69d541f1b8e456eb5d405b1558df9885.zip
stage-2: simplify exporting path
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh17
-rw-r--r--nixos/modules/system/boot/stage-2.nix10
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 f827e530f87..99930fb95a6 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 7e4ec2a4a67..a6864bf80c3 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}