diff --git a/pkgs/development/compilers/ghc/wrapper.nix b/pkgs/development/compilers/ghc/wrapper.nix index bc28fdc91319..55fd16be5edb 100644 --- a/pkgs/development/compilers/ghc/wrapper.nix +++ b/pkgs/development/compilers/ghc/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, ghc, makeWrapper, coreutils }: +{ stdenv, ghc, makeWrapper, coreutils, forUserEnv ? false }: let ghc761OrLater = !stdenv.lib.versionOlder ghc.version "7.6.1"; @@ -54,4 +54,11 @@ stdenv.mkDerivation ({ inherit ghc; inherit (ghc) meta; ghcVersion = ghc.version; -} // (stdenv.lib.optionalAttrs ghc761OrLater { preFixup = "sed -i -e 's|-package-conf|${packageDBFlag}|' $out/bin/ghc-get-packages.sh"; })) +} // (stdenv.lib.optionalAttrs ghc761OrLater { preFixup = "sed -i -e 's|-package-conf|${packageDBFlag}|' $out/bin/ghc-get-packages.sh"; }) + // (stdenv.lib.optionalAttrs forUserEnv { + postFixup= '' + ln -s $ghc/lib $out/lib; + mkdir -p $out/share/doc + ln -s $ghc/share/doc/ghc $out/share/doc/ghc-${ghc.version} + ''; + })) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 7c6c237b194b..3bf5d3d7f749 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -89,6 +89,16 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y); ghc = ghc; # refers to ghcPlain }; + # The normal GHC wrapper doesn't create links to the documentation in + # ~/.nix-profile. Having this second wrapper allows us to remedy the + # situation without re-building all Haskell packages. At the next + # stdenv-updates merge, this second wrapper will go away. + + ghcUserEnvWrapper = pkgs.appendToName "new" (callPackage ../development/compilers/ghc/wrapper.nix { + ghc = ghc; # refers to ghcPlain + forUserEnv = true; + }); + # An experimental wrapper around ghcPlain that does not automatically # pick up packages from the profile, but instead has a fixed set of packages # in its global database. The set of packages can be specified as an