mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
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>
This commit is contained in:
parent
7d9fb8625e
commit
6f683e4ba3
@ -72,20 +72,21 @@ mkDerivation {
|
|||||||
phases = [ "buildPhase" "fixupPhase" ];
|
phases = [ "buildPhase" "fixupPhase" ];
|
||||||
setupNew = substituteAll {
|
setupNew = substituteAll {
|
||||||
src = ../../stdenv/generic/setup.sh;
|
src = ../../stdenv/generic/setup.sh;
|
||||||
initialPath= (import ../../stdenv/common-path.nix) { inherit pkgs; };
|
|
||||||
inherit gcc;
|
inherit gcc;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = let
|
||||||
|
initialPath = import ../../stdenv/common-path.nix { inherit pkgs; };
|
||||||
|
in ''
|
||||||
set -x
|
set -x
|
||||||
mkdir -p "$out/dev-envs" "$out/nix-support" "$out/bin"
|
mkdir -p "$out/dev-envs" "$out/nix-support" "$out/bin"
|
||||||
s="$out/nix-support/setup-new-modified"
|
s="$out/nix-support/setup-new-modified"
|
||||||
cp "$setupNew" "$s"
|
|
||||||
# shut some warning up.., do not use set -e
|
# shut some warning up.., do not use set -e
|
||||||
sed -e 's@set -e@@' \
|
sed -e 's@set -e@@' \
|
||||||
-e 's@assertEnvExists\s\+NIX_STORE@:@' \
|
-e 's@assertEnvExists\s\+NIX_STORE@:@' \
|
||||||
-e 's@trap.*@@' \
|
-e 's@trap.*@@' \
|
||||||
-i "$s"
|
-e '1i initialPath="${toString initialPath}"' \
|
||||||
|
"$setupNew" > "$s"
|
||||||
cat >> "$out/dev-envs/''${name/env-/}" << EOF
|
cat >> "$out/dev-envs/''${name/env-/}" << EOF
|
||||||
nativeBuildInputs="$nativeBuildInputs"
|
nativeBuildInputs="$nativeBuildInputs"
|
||||||
propagatedBuildInputs="$propagatedBuildInputs2"
|
propagatedBuildInputs="$propagatedBuildInputs2"
|
||||||
|
Loading…
Reference in New Issue
Block a user