ghc-wrapper: install the GHC documentation into the user's profile

The freaky implementation was done that way in order to avoid unnecessary
re-builds of all Haskell packages by changing the wrapper script used
internally in those builds.

See <https://github.com/NixOS/nixpkgs/pull/466> for further details.
This commit is contained in:
Patrick John Wheeler 2013-04-17 00:06:10 +02:00 committed by Peter Simons
parent 65b95b159e
commit 3bf0d2b960
2 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, ghc, makeWrapper, coreutils }: { stdenv, ghc, makeWrapper, coreutils, forUserEnv ? false }:
let let
ghc761OrLater = !stdenv.lib.versionOlder ghc.version "7.6.1"; ghc761OrLater = !stdenv.lib.versionOlder ghc.version "7.6.1";
@ -54,4 +54,11 @@ stdenv.mkDerivation ({
inherit ghc; inherit ghc;
inherit (ghc) meta; inherit (ghc) meta;
ghcVersion = ghc.version; 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}
'';
}))

View File

@ -89,6 +89,16 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
ghc = ghc; # refers to ghcPlain 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 # An experimental wrapper around ghcPlain that does not automatically
# pick up packages from the profile, but instead has a fixed set of packages # 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 # in its global database. The set of packages can be specified as an