@@ -9,7 +9,12 @@
99, flags
1010, cabalFile
1111, patches ? []
12−, postUnpack ? null
12+
13+, preUnpack ? null, postUnpack ? null
14+, preConfigure ? null, postConfigure ? null
15+, preBuild ? null, postBuild ? null
16+, preCheck ? null, postCheck ? null
17+, preInstall ? null, postInstall ? null
1318}:
1419
1520let
@@ -160,29 +165,46 @@ in stdenv.mkDerivation ({
160165 '';
161166
162167 configurePhase = ''
168+ runHook preConfigure
163169 echo Configure flags:
164170 printf "%q " ${finalConfigureFlags}
165171 echo
166172 $SETUP_HS configure ${finalConfigureFlags}
173+ runHook postConfigure
167174 '';
168175
169176 buildPhase = ''
177+ runHook preBuild
170178 $SETUP_HS build -j$NIX_BUILD_CORES ${lib.concatStringsSep " " component.setupBuildFlags}
179+ runHook postBuild
171180 '';
172181
173182 checkPhase = ''
183+ runHook preCheck
174184 $SETUP_HS test
185+ runHook postCheck
175186 '';
176187
177188 installPhase = ''
189+ runHook preInstall
178190 $SETUP_HS copy
179191 ${lib.optionalString (haskellLib.isLibrary componentId) ''
180192 $SETUP_HS register --gen-pkg-config=${name}.conf
181193 ${ghc.targetPrefix}ghc-pkg init $out/package.conf.d
182194 ${ghc.targetPrefix}ghc-pkg --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
183195 ''}
196+ runHook postInstall
184197 '';
185198}
186199// lib.optionalAttrs (patches != []) { inherit patches; }
187−// lib.optionalAttrs (postUnpack != null) { inherit postUnpack; }
200+// lib.optionalAttrs (preUnpack != "") { inherit preUnpack; }
201+// lib.optionalAttrs (postUnpack != "") { inherit postUnpack; }
202+// lib.optionalAttrs (preConfigure != "") { inherit preConfigure; }
203+// lib.optionalAttrs (postConfigure != "") { inherit postConfigure; }
204+// lib.optionalAttrs (preBuild != "") { inherit preBuild; }
205+// lib.optionalAttrs (postBuild != "") { inherit postBuild; }
206+// lib.optionalAttrs (preCheck != "") { inherit preCheck; }
207+// lib.optionalAttrs (postCheck != "") { inherit postCheck; }
208+// lib.optionalAttrs (preInstall != "") { inherit preInstall; }
209+// lib.optionalAttrs (postInstall != "") { inherit postInstall; }
188210)