diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh index fc41976b7d17..4fa722a73dd2 100644 --- a/pkgs/stdenv/generic/builder.sh +++ b/pkgs/stdenv/generic/builder.sh @@ -6,14 +6,11 @@ done mkdir $out -echo "$preHook" > $out/setup +echo "export SHELL=$shell" > $out/setup +echo "initialPath=\"$initialPath\"" >> $out/setup +echo "$preHook" >> $out/setup cat "$setup" >> $out/setup -sed -e "s^@initialPath@^$initialPath^g" \ - -e "s^@shell@^$shell^g" \ - < $out/setup > $out/setup.tmp -mv $out/setup.tmp $out/setup - # Allow the user to install stdenv using nix-env and get the packages # in stdenv. mkdir $out/nix-support diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 2c9ede898def..0ff0bcebbd46 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -112,11 +112,6 @@ let builder = shell; args = ["-e" ./builder.sh]; - /* TODO: special-cased @var@ substitutions are ugly. - However, using substituteAll* from setup.sh seems difficult, - as setup.sh can't be directly sourced. - Suggestion: split similar utility functions into a separate script. - */ setup = setupScript; diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 675d8ce797d1..6ed94673ae70 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -163,7 +163,7 @@ shopt -s nullglob # Set up the initial path. PATH= -for i in @initialPath@; do +for i in $initialPath; do if [ "$i" = / ]; then i=; fi addToSearchPath PATH $i/bin addToSearchPath PATH $i/sbin @@ -174,17 +174,15 @@ if [ "$NIX_DEBUG" = 1 ]; then fi -# Execute the pre-hook. -export SHELL=@shell@ -export CONFIG_SHELL="$SHELL" -if [ -z "$shell" ]; then export shell=@shell@; fi -runHook preHook - - # Check that the pre-hook initialised SHELL. if [ -z "$SHELL" ]; then echo "SHELL not set"; exit 1; fi +# Execute the pre-hook. +export CONFIG_SHELL="$SHELL" +if [ -z "$shell" ]; then export shell=$SHELL; fi + + envHooks=() crossEnvHooks=()