about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/configuration-common.nix
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2019-04-02 17:39:53 -0500
committerAustin Seipp <aseipp@pobox.com>2019-04-07 00:45:22 -0500
commit12db6c18f94624fd39ffac96caa92c28b45c5923 (patch)
treeede61c3929a07ea453fc4dd0de06e2ebbed69a52 /pkgs/development/haskell-modules/configuration-common.nix
parent536c72a62b76714aa80a1fb48580d7cb5155962c (diff)
downloadnixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar.gz
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar.bz2
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar.lz
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar.xz
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.tar.zst
nixlib-12db6c18f94624fd39ffac96caa92c28b45c5923.zip
cryptol: fix, rework cryptol 2.6.0 builds
  - The previous build of Cryptol was broken on GHC 8.6.x, which is now the
  new default. That's been fixed with a few upstream patches that will come
  up whenever the next release happens.

  - There was also a build failure on base-compat, fixed by jailbreaking.

  - The previous setup had all-packages.nix creating a new derivation
  solely for the purpose of wrapping the Z3 binary. This has been removed:
  the wrapper is still added but during the Haskell build itself, so that
  all Haskell dependent packages can use the cryptol interpreters too.

  - In its place, we use justStaticExecutables, so people using nix-env
  and Cryptol users who *don't* need haskell dependencies can get much
  smaller closures. Obviously this still implies a second build, but
  this build is much more useful than one that merely adds a shell
  script to a package that's relatively expensive to compile...

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Diffstat (limited to 'pkgs/development/haskell-modules/configuration-common.nix')
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix34
1 files changed, 32 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index c439d2cca00d..d9da4d2074c7 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -871,8 +871,38 @@ self: super: {
   # https://github.com/takano-akio/filelock/issues/5
   filelock = dontCheck super.filelock;
 
-  # cryptol-2.5.0 doesn't want happy 1.19.6+.
-  cryptol = super.cryptol.override { happy = self.happy_1_19_5; };
+  # fix GHC 8.6 builds by using irrefutable patterns. jailbreak is also
+  # required due to a constraint failure for base-compat.
+  cryptol = doJailbreak (overrideCabal super.cryptol (drv: {
+
+    # the last patch fixes ghc 8.6 builds; the other two (small) patches fix a
+    # few bugs between them, but are also hard dependencies
+    patches = drv.patches or [] ++ [
+      (pkgs.fetchpatch {
+        url    = https://github.com/GaloisInc/cryptol/commit/634c5a03e757663bf86d1ffad1ce2c6086d4483f.patch;
+        sha256 = "16dvfihsl2c4jnyfndgrjarkm3z5pyn7rzg2svnidx0qipwrxzm7";
+      })
+      (pkgs.fetchpatch {
+        url    = https://github.com/GaloisInc/cryptol/commit/515642328aff6d958ff1b534b9effdd726901b60.patch;
+        sha256 = "1fml71b720igyh8s7mj1z1c2bbv1vk490iy7blvxp625nymzjij6";
+      })
+      (pkgs.fetchpatch {
+        url    = https://github.com/GaloisInc/cryptol/commit/a8eab11b319f6434f9b01b26d419b8305ff30bc2.patch;
+        sha256 = "1bbznp3kbj8l83q979gf4gr2khwbyqi85ykwsf2jnkhzda6pr0n8";
+      })
+    ];
+
+    buildTools = drv.buildTools or [] ++ [ pkgs.makeWrapper ];
+
+    # make sure the binaries always start up. previously this was in
+    # all-packages.nix but it's almost certainly better to do it here (e.g. a
+    # haskell deps may use cryptol in the test suite or something, etc)
+    postInstall = drv.postInstall or "" + ''
+      for b in $out/bin/cryptol $out/bin/cryptol-html; do
+        wrapProgram $b --prefix 'PATH' ':' "${pkgs.lib.getBin pkgs.z3}/bin"
+      done
+    '';
+  }));
 
   # Tests try to invoke external process and process == 1.4
   grakn = dontCheck (doJailbreak super.grakn);