diff options
author | sternenseemann <sternenseemann@systemli.org> | 2021-11-25 13:52:57 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2021-11-25 15:42:47 +0100 |
commit | 5384a35a0c5198e224435b7295b3d273e645243d (patch) | |
tree | 32b5a2dffd53b1ec18d7c00bb390090e65902a78 | |
parent | 579bc49e9485b337b0b13671fc3e368c6c93483b (diff) | |
download | nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar.gz nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar.bz2 nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar.lz nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar.xz nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.tar.zst nixpkgs-5384a35a0c5198e224435b7295b3d273e645243d.zip |
haskell.compiler.ghc*Binary: add all missing runtimeDeps to PATH
This brings the binary GHCs on parity with the source built ones in terms of the wrapper. The upshot of this is that compiling something using the binary GHCs no longer depends on PATH being populated with the tools included in stdenv at all. We can even test this by running the installCheck with an empty environment (via `env -i`).
-rw-r--r-- | pkgs/development/compilers/ghc/8.10.2-binary.nix | 18 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/8.10.7-binary.nix | 16 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/8.6.5-binary.nix | 16 |
3 files changed, 41 insertions, 9 deletions
diff --git a/pkgs/development/compilers/ghc/8.10.2-binary.nix b/pkgs/development/compilers/ghc/8.10.2-binary.nix index d610e4bcd8c..a29a5b0b5ab 100644 --- a/pkgs/development/compilers/ghc/8.10.2-binary.nix +++ b/pkgs/development/compilers/ghc/8.10.2-binary.nix @@ -3,6 +3,8 @@ , ncurses5 , ncurses6, gmp, libiconv, numactl , llvmPackages +, coreutils +, targetPackages # minimal = true; will remove files that aren't strictly necessary for # regular builds and GHC bootstrapping. @@ -140,8 +142,17 @@ let libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" + "LD_LIBRARY_PATH"; - runtimeDeps = lib.optionals useLLVM [ + runtimeDeps = [ + targetPackages.stdenv.cc + targetPackages.stdenv.cc.bintools + coreutils # for cat + ] + ++ lib.optionals useLLVM [ (lib.getBin llvmPackages.llvm) + ] + # On darwin, we need unwrapped bintools as well (for otool) + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ + targetPackages.stdenv.cc.bintools.bintools ]; in @@ -372,7 +383,6 @@ stdenv.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' - unset ${libEnvVar} # Sanity check, can ghc create executables? cd $TMP mkdir test-ghc; cd test-ghc @@ -381,7 +391,9 @@ stdenv.mkDerivation rec { module Main where main = putStrLn \$([|"yes"|]) EOF - $out/bin/ghc --make main.hs || exit 1 + # can't use env -i here because otherwise we don't find -lgmp on musl + env ${libEnvVar}= PATH= \ + $out/bin/ghc --make main.hs || exit 1 echo compilation ok [ $(./main) == "yes" ] ''; diff --git a/pkgs/development/compilers/ghc/8.10.7-binary.nix b/pkgs/development/compilers/ghc/8.10.7-binary.nix index b8164ae9f6f..7b10f60affd 100644 --- a/pkgs/development/compilers/ghc/8.10.7-binary.nix +++ b/pkgs/development/compilers/ghc/8.10.7-binary.nix @@ -3,6 +3,8 @@ , ncurses5 , ncurses6, gmp, libiconv, numactl , llvmPackages +, coreutils +, targetPackages # minimal = true; will remove files that aren't strictly necessary for # regular builds and GHC bootstrapping. @@ -155,8 +157,17 @@ let libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" + "LD_LIBRARY_PATH"; - runtimeDeps = lib.optionals useLLVM [ + runtimeDeps = [ + targetPackages.stdenv.cc + targetPackages.stdenv.cc.bintools + coreutils # for cat + ] + ++ lib.optionals useLLVM [ (lib.getBin llvmPackages.llvm) + ] + # On darwin, we need unwrapped bintools as well (for otool) + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ + targetPackages.stdenv.cc.bintools.bintools ]; in @@ -370,7 +381,6 @@ stdenv.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' - unset ${libEnvVar} # Sanity check, can ghc create executables? cd $TMP mkdir test-ghc; cd test-ghc @@ -379,7 +389,7 @@ stdenv.mkDerivation rec { module Main where main = putStrLn \$([|"yes"|]) EOF - $out/bin/ghc --make main.hs || exit 1 + env -i $out/bin/ghc --make main.hs || exit 1 echo compilation ok [ $(./main) == "yes" ] ''; diff --git a/pkgs/development/compilers/ghc/8.6.5-binary.nix b/pkgs/development/compilers/ghc/8.6.5-binary.nix index 95b381b955f..22bfae79c0c 100644 --- a/pkgs/development/compilers/ghc/8.6.5-binary.nix +++ b/pkgs/development/compilers/ghc/8.6.5-binary.nix @@ -2,6 +2,8 @@ , fetchurl, perl, gcc , ncurses5, ncurses6, gmp, glibc, libiconv , llvmPackages +, coreutils +, targetPackages }: # Prebuilt only does native @@ -30,8 +32,17 @@ let downloadsUrl = "https://downloads.haskell.org/ghc"; - runtimeDeps = lib.optionals useLLVM [ + runtimeDeps = [ + targetPackages.stdenv.cc + targetPackages.stdenv.cc.bintools + coreutils # for cat + ] + ++ lib.optionals useLLVM [ (lib.getBin llvmPackages.llvm) + ] + # On darwin, we need unwrapped bintools as well (for otool) + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ + targetPackages.stdenv.cc.bintools.bintools ]; in @@ -175,7 +186,6 @@ stdenv.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' - unset ${libEnvVar} # Sanity check, can ghc create executables? cd $TMP mkdir test-ghc; cd test-ghc @@ -184,7 +194,7 @@ stdenv.mkDerivation rec { module Main where main = putStrLn \$([|"yes"|]) EOF - $out/bin/ghc --make main.hs || exit 1 + env -i $out/bin/ghc --make main.hs || exit 1 echo compilation ok [ $(./main) == "yes" ] ''; |