summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorAndres Loeh <mail@andres-loeh.de>2012-12-16 14:15:04 +0100
committerAndres Loeh <mail@andres-loeh.de>2012-12-16 14:25:15 +0100
commitd068aa986167abcbf1b25f439b74136b4060f2fd (patch)
tree7d559e6c538fd01bca85ad1326a06c990cde7ed2 /pkgs/development/compilers
parente89aea5e424f21d863ac9cf278d5f8b3229d17d0 (diff)
downloadnixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar.gz
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar.bz2
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar.lz
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar.xz
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.tar.zst
nixlib-d068aa986167abcbf1b25f439b74136b4060f2fd.zip
Patch ghc-paths to interact better with ghcWithPackages.
When the ghc-paths library is compiled, the paths of the
compiler it is compiled with are being hardcoded in the
library (and can then be queried from other applications
using the library).

But on Nix, packages are compiled with ghc-wrapper, and
subsequently possibly used with a special version of ghc
generated for a particular environment of packages. So
one version of ghc-paths may potentially end up being
used by lots of different instances of ghc. The hardcoding
approach fails.

As a work-around, we now patch ghc-paths so that it allows
setting the paths that can be queried via environment
variables. Specific GHC environments can then set these
environment variables in the wrapper shell script that
invokes GHC.

This should at least partially solve issue #213.
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/with-packages.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/development/compilers/ghc/with-packages.nix b/pkgs/development/compilers/ghc/with-packages.nix
index f4f567f30b39..07071ef8414a 100644
--- a/pkgs/development/compilers/ghc/with-packages.nix
+++ b/pkgs/development/compilers/ghc/with-packages.nix
@@ -79,7 +79,12 @@ stdenv.mkDerivation rec {
     echo -n "Generating wrappers "
 
     for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
-      makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "-B$linkedTopDir"
+      # The NIX env-vars are picked up by our patched version of ghc-paths.
+      makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
+        --add-flags "-B$linkedTopDir" \
+        --set "NIX_GHC"        "$out/bin/ghc"     \
+        --set "NIX_GHCPKG"     "$out/bin/ghc-pkg" \
+        --set "NIX_GHC_LIBDIR" "$linkedTopDir"
       echo -n .
     done