git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commit6f683e4ba30d85c2665b83da4a578fc577a0047c authoraszlig <aszlig@redmoonstudios.org> dateTue 25 Nov 2014, 14:05 (12 years ago) parent7d9fb86
1 file changed+5−4
pkgs/misc/my-env/default.nix+5−4
pkgs/misc/my-env/default.nix+5−4
@@ -72,20 +72,21 @@ mkDerivation {
7272 phases = [ "buildPhase" "fixupPhase" ];
7373 setupNew = substituteAll {
7474 src = ../../stdenv/generic/setup.sh;
75− initialPath= (import ../../stdenv/common-path.nix) { inherit pkgs; };
7675 inherit gcc;
7776 };
7877
79− buildPhase = ''
78+ buildPhase = let
79+ initialPath = import ../../stdenv/common-path.nix { inherit pkgs; };
80+ in ''
8081 set -x
8182 mkdir -p "$out/dev-envs" "$out/nix-support" "$out/bin"
8283 s="$out/nix-support/setup-new-modified"
83− cp "$setupNew" "$s"
8484 # shut some warning up.., do not use set -e
8585 sed -e 's@set -e@@' \
8686 -e 's@assertEnvExists\s\+NIX_STORE@:@' \
8787 -e 's@trap.*@@' \
88− -i "$s"
88+ -e '1i initialPath="${toString initialPath}"' \
89+ "$setupNew" > "$s"
8990 cat >> "$out/dev-envs/''${name/env-/}" << EOF
9091 nativeBuildInputs="$nativeBuildInputs"
9192 propagatedBuildInputs="$propagatedBuildInputs2"