summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-11-25 14:05:21 +0100
committeraszlig <aszlig@redmoonstudios.org>2014-11-25 14:14:43 +0100
commit6f683e4ba30d85c2665b83da4a578fc577a0047c (patch)
treec4cbc12e975543945e8ed39d5ffa1b672ea4afac /pkgs
parent7d9fb8625e1e2ce6732c7b4afe1c6fdbe03e35ad (diff)
downloadnixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar.gz
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar.bz2
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar.lz
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar.xz
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.tar.zst
nixlib-6f683e4ba30d85c2665b83da4a578fc577a0047c.zip
my-env: Use sed to substitute $initialPath.
initialPath is now added to the top of the modified setup.sh. It's not
very nice altogether to patch setup.sh in this way, as it is prone to
break on setup.sh changes, but it should (hopefully finally, but
unfortunately only temporarily) fix the issue ewemoa (in #nixos) had
with myEnvFun.

In the long term, if people want to have roughly similar functionality,
nix-shell provides a better way for that, so maybe we might either
remove myEnvFun or replace it with a smaller implementation using
nix-shell.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/misc/my-env/default.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/misc/my-env/default.nix b/pkgs/misc/my-env/default.nix
index 4b0336b30da9..7d37576e4cdb 100644
--- a/pkgs/misc/my-env/default.nix
+++ b/pkgs/misc/my-env/default.nix
@@ -72,20 +72,21 @@ mkDerivation {
   phases = [ "buildPhase" "fixupPhase" ];
   setupNew = substituteAll {
     src = ../../stdenv/generic/setup.sh;
-    initialPath= (import ../../stdenv/common-path.nix) { inherit pkgs; };
     inherit gcc;
   };
 
-  buildPhase = ''
+  buildPhase = let
+    initialPath = import ../../stdenv/common-path.nix { inherit pkgs; };
+  in ''
     set -x
     mkdir -p "$out/dev-envs" "$out/nix-support" "$out/bin"
     s="$out/nix-support/setup-new-modified"
-    cp "$setupNew" "$s"
     # shut some warning up.., do not use set -e
     sed -e 's@set -e@@' \
         -e 's@assertEnvExists\s\+NIX_STORE@:@' \
         -e 's@trap.*@@' \
-        -i "$s"
+        -e '1i initialPath="${toString initialPath}"' \
+        "$setupNew" > "$s"
     cat >> "$out/dev-envs/''${name/env-/}" << EOF
       nativeBuildInputs="$nativeBuildInputs"
       propagatedBuildInputs="$propagatedBuildInputs2"