@@ -1,7 +1,10 @@
1{ stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }:
1{ stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }:
3{ component, package, name, src, flags, revision, patches, defaultSetupSrc
3{ 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
@@ -16,7 +19,12 @@ let
16 inherit fullName flags component;
19 inherit fullName flags component;
18 hooks = haskellLib.optionalHooks {
21 hooks = haskellLib.optionalHooks {
19− inherit preUnpack postUnpack;
23+ preUnpack postUnpack
26+ preInstall postInstall
22 executableToolDepends =
30 executableToolDepends =
@@ -54,6 +62,7 @@ in
55 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
63 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
56 buildPhase = ''
64 buildPhase = ''
57 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
66 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
58 cat ${defaultSetupSrc} > Setup.hs
67 cat ${defaultSetupSrc} > Setup.hs
@@ -66,11 +75,14 @@ in
68 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
77 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
71 installPhase = ''
81 installPhase = ''
72 mkdir -p $out/bin
83 mkdir -p $out/bin
73 install ./Setup $out/bin/Setup
84 install ./Setup $out/bin/Setup
76 // (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; })
88 // (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; })