@@ -1,70 +0,0 @@
1−{ stdenv, ghc, packages, buildEnv, makeWrapper, ignoreCollisions ? false }:
3−# This wrapper works only with GHC 6.12 or later.
4−assert stdenv.lib.versionOlder "6.12" ghc.version;
6−# It's probably a good idea to include the library "ghc-paths" in the
7−# compiler environment, because we have a specially patched version of
8−# that package in Nix that honors these environment variables
15−# instead of hard-coding the paths. The wrapper sets these variables
16−# appropriately to configure ghc-paths to point back to the wrapper
17−# instead of to the pristine GHC package, which doesn't know any of the
18−# additional libraries.
20−# A good way to import the environment set by the wrapper below into
21−# your shell is to add the following snippet to your ~/.bashrc:
23−# if [ -e ~/.nix-profile/bin/ghc ]; then
24−# eval $(grep export ~/.nix-profile/bin/ghc)
28− ghc761OrLater = stdenv.lib.versionOlder "7.6.1" ghc.version;
29− packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
30− libDir = "$out/lib/ghc-${ghc.version}";
31− docDir = "$out/share/doc/ghc/html";
32− packageCfgDir = "${libDir}/package.conf.d";
33− isHaskellPkg = x: (x ? pname) && (x ? version);
35−if packages == [] then ghc else
37− name = "haskell-env-${ghc.name}";
38− paths = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages) ++ [ghc];
39− inherit ignoreCollisions;
41− . ${makeWrapper}/nix-support/setup-hook
43− for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
45− makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
46− --add-flags '"-B$NIX_GHC_LIBDIR"' \
47− --set "NIX_GHC" "$out/bin/ghc" \
48− --set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
49− --set "NIX_GHC_DOCDIR" "${docDir}" \
50− --set "NIX_GHC_LIBDIR" "${libDir}"
53− for prg in runghc runhaskell; do
55− makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
56− --add-flags "-f $out/bin/ghc" \
57− --set "NIX_GHC" "$out/bin/ghc" \
58− --set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
59− --set "NIX_GHC_DOCDIR" "${docDir}" \
60− --set "NIX_GHC_LIBDIR" "${libDir}"
63− for prg in ghc-pkg ghc-pkg-${ghc.version}; do
65− makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
68− $out/bin/ghc-pkg recache