on iko/ghcjs-patch-master help sign in
Adds hooks
commit9151dff3f36b60da3dd0b56c4628d0aa4c19dcdb authorMoritz Angermann <moritz.angermann@gmail.com> dateMon 26 Nov 2018, 17:26 (8 years ago) parent5a750e0
3 files changed+78−5
builder/comp-builder.nix+24−2 builder/default.nix+12−1 modules/package.nix+42−2
builder/comp-builder.nix+24−2
@@ -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)
builder/default.nix+12−1
@@ -10,7 +10,17 @@
1010, revision
1111, revisionSha256
1212, patches
13+
14+, preUnpack
1315, postUnpack
16+, preConfigure
17+, postConfigure
18+, preBuild
19+, postBuild
20+, preCheck
21+, postCheck
22+, preInstall
23+, postInstall
1424
1525, ...
1626}@config:
@@ -59,7 +69,8 @@ let
5969 comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix { inherit ghc haskellLib nonReinstallablePkgs; };
6070
6171 buildComp = componentId: component: comp-builder {
62− inherit componentId component package name src flags setup cabalFile patches postUnpack;
72+ inherit componentId component package name src flags setup cabalFile patches
73+ preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall;
6374 };
6475
6576in {
modules/package.nix+42−2
@@ -125,7 +125,7 @@ in {
125125 };
126126 setupBuildFlags = mkOption {
127127 type = listOfFilteringNulls str;
128− default = [];
128+ default = config.setupBuildFlags;
129129 };
130130 doExactConfig = mkOption {
131131 type = bool;
@@ -185,9 +185,49 @@ in {
185185 type = listOf (either package path);
186186 default = [];
187187 };
188− postUnpack = mkOption {
188+ setupBuildFlags = mkOption {
189+ type = listOfFilteringNulls str;
190+ default = [];
191+ };
192+ preUnpack = mkOption {
189193 type = nullOr lines;
190194 default = null;
191195 };
196+ postUnpack = mkOption {
197+ type = nullOr string;
198+ default = null;
199+ };
200+ preConfigure = mkOption {
201+ type = nullOr string;
202+ default = null;
203+ };
204+ postConfigure = mkOption {
205+ type = nullOr string;
206+ default = null;
207+ };
208+ preBuild = mkOption {
209+ type = nullOr string;
210+ default = null;
211+ };
212+ postBuild = mkOption {
213+ type = nullOr string;
214+ default = null;
215+ };
216+ preCheck = mkOption {
217+ type = nullOr string;
218+ default = null;
219+ };
220+ postCheck = mkOption {
221+ type = nullOr string;
222+ default = null;
223+ };
224+ preInstall = mkOption {
225+ type = nullOr string;
226+ default = null;
227+ };
228+ postInstall = mkOption {
229+ type = nullOr string;
230+ default = null;
231+ };
192232 };
193233}