@@ -1,7 +1,10 @@
11{ stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }:
22
33{ component, package, name, src, flags, revision, patches, defaultSetupSrc
4−, preUnpack ? null, postUnpack ? null
4+, preUnpack ? component.preUnpack, postUnpack ? component.postUnpack
5+, prePatch ? null, postPatch ? null
6+, preBuild ? component.preBuild , postBuild ? component.postBuild
7+, preInstall ? component.preInstall , postInstall ? component.postInstall
58}:
69
710let
@@ -16,7 +19,12 @@ let
1619 inherit fullName flags component;
1720 };
1821 hooks = haskellLib.optionalHooks {
19− inherit preUnpack postUnpack;
22+ inherit
23+ preUnpack postUnpack
24+ prePatch postPatch
25+ preBuild postBuild
26+ preInstall postInstall
27+ ;
2028 };
2129
2230 executableToolDepends =
@@ -54,6 +62,7 @@ in
5462
5563 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
5664 buildPhase = ''
65+ runHook preBuild
5766 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
5867 cat ${defaultSetupSrc} > Setup.hs
5968 fi
@@ -66,11 +75,14 @@ in
6675 fi
6776 done
6877 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
78+ runHook preBuild
6979 '';
7080
7181 installPhase = ''
82+ runHook preInstall
7283 mkdir -p $out/bin
7384 install ./Setup $out/bin/Setup
85+ runHook postInstall
7486 '';
7587 }
7688 // (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; })