haskell.compiler.*: prefix PATH with runtimeDeps

This will prevent freak accidents where the wrong tools are used because
they are in PATH by chance.
This commit is contained in:
sternenseemann 2021-11-25 13:12:40 +01:00
parent 5384a35a0c
commit 035f20bc6b
5 changed files with 15 additions and 15 deletions

View file

@ -134,7 +134,7 @@ let
runtimeDeps = [
targetPackages.stdenv.cc.bintools
coreutils
coreutils # for cat
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -321,11 +321,11 @@ stdenv.mkDerivation (rec {
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
# Patch scripts to include runtime dependencies in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' $i
done
'';

View file

@ -142,7 +142,7 @@ let
runtimeDeps = [
targetPackages.stdenv.cc.bintools
coreutils
coreutils # for cat
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -320,11 +320,11 @@ stdenv.mkDerivation (rec {
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
# Patch scripts to include runtime dependencies in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' $i
done
'';

View file

@ -129,7 +129,7 @@ let
runtimeDeps = [
targetPackages.stdenv.cc.bintools
coreutils
coreutils # for cat
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -286,11 +286,11 @@ stdenv.mkDerivation (rec {
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
# Patch scripts to include runtime dependencies in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' $i
done
'';

View file

@ -128,7 +128,7 @@ let
runtimeDeps = [
targetPackages.stdenv.cc.bintools
coreutils
coreutils # for cat
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -289,11 +289,11 @@ stdenv.mkDerivation (rec {
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
# Patch scripts to include runtime dependencies in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' $i
done
'';

View file

@ -142,7 +142,7 @@ let
runtimeDeps = [
targetPackages.stdenv.cc.bintools
coreutils
coreutils # for cat
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -309,11 +309,11 @@ stdenv.mkDerivation (rec {
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
# Patch scripts to include runtime dependencies in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' $i
done
'';