ghcWithPackages: add postBuild hook so that users can mess with the generated environment

postBuild can be used to execute user-specific commands on the generated $out
environment before finalizing the build. For example, this hook can be used to
generate appropriate 'makeWrapper' script for binaries contained in the
environment.
This commit is contained in:
Peter Simons 2015-04-28 13:14:05 +02:00
parent 71910be9ea
commit c449a930aa

View File

@ -1,6 +1,7 @@
{ stdenv, lib, ghc, llvmPackages, packages, buildEnv
, makeWrapper
, ignoreCollisions ? false, withLLVM ? false }:
{ stdenv, lib, ghc, llvmPackages, packages, buildEnv, makeWrapper
, ignoreCollisions ? false, withLLVM ? false
, postBuild ? ""
}:
# This wrapper works only with GHC 6.12 or later.
assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
@ -89,7 +90,7 @@ buildEnv {
${lib.optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
$out/bin/${ghcCommand}-pkg check
'';
'' + postBuild;
} // {
preferLocalBuild = true;
inherit (ghc) version meta;