summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/generic-builder.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-02-25 20:15:26 +0100
committerPeter Simons <simons@cryp.to>2015-03-09 15:55:25 +0100
commitc7764773502a239b42a119cd2df38be14a8829ee (patch)
tree881e06a6c0a1dfde6ac8232d15516db8be61036a /pkgs/development/haskell-modules/generic-builder.nix
parent3e9e1a2f4e70a09445da2f9ad0227dc66185d2c5 (diff)
downloadnixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar.gz
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar.bz2
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar.lz
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar.xz
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.tar.zst
nixlib-c7764773502a239b42a119cd2df38be14a8829ee.zip
haskell-generic-builder: update and jailbreak cabal files before patchPhase is run
The updated and jailbroken Cabal file must be in place before the
'patchPhase' hook is run, otherwise we cannot use that hook to patch the
Cabal file! Resolves https://github.com/NixOS/nixpkgs/issues/5922.

As an added bonus, this change makes the "jailbreakPhase" obsolete.
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix25
1 files changed, 9 insertions, 16 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 73851786f830..faf1ce4046e2 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -111,7 +111,7 @@ stdenv.mkDerivation ({
   name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}";
 
   prePhases = ["setupCompilerEnvironmentPhase"];
-  preConfigurePhases = ["jailbreakPhase" "compileBuildDriverPhase"];
+  preConfigurePhases = ["compileBuildDriverPhase"];
   preInstallPhases = ["haddockPhase"];
 
   inherit src;
@@ -121,6 +121,14 @@ stdenv.mkDerivation ({
 
   LANG = "en_US.UTF-8";         # GHC needs the locale configured during the Haddock phase.
 
+  prePatch = optionalString (editedCabalFile != null) ''
+    echo "Replacing Cabal file with edited version ${newCabalFile}."
+    cp ${newCabalFile} ${pname}.cabal
+  '' + optionalString jailbreak ''
+    echo "Running jailbreak-cabal to lift version restrictions on build inputs."
+    ${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
+  '' + prePatch;
+
   setupCompilerEnvironmentPhase = ''
     runHook preSetupCompilerEnvironment
 
@@ -155,20 +163,6 @@ stdenv.mkDerivation ({
     runHook postSetupCompilerEnvironment
   '';
 
-  jailbreakPhase = ''
-    runHook preJailbreak
-
-    ${optionalString (editedCabalFile != null) ''
-      echo "Replacing Cabal file with edited version ${newCabalFile}."
-      cp ${newCabalFile} ${pname}.cabal
-    ''}${optionalString jailbreak ''
-      echo "Running jailbreak-cabal to lift version restrictions on build inputs."
-      ${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
-    ''}
-
-    runHook postJailbreak
-  '';
-
   compileBuildDriverPhase = ''
     runHook preCompileBuildDriver
 
@@ -283,7 +277,6 @@ stdenv.mkDerivation ({
 // optionalAttrs (configureFlags != []) { inherit configureFlags; }
 // optionalAttrs (patches != [])        { inherit patches; }
 // optionalAttrs (patchPhase != "")     { inherit patchPhase; }
-// optionalAttrs (prePatch != "")       { inherit prePatch; }
 // optionalAttrs (postPatch != "")      { inherit postPatch; }
 // optionalAttrs (preConfigure != "")   { inherit preConfigure; }
 // optionalAttrs (postConfigure != "")  { inherit postConfigure; }