git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commit12db6c18f94624fd39ffac96caa92c28b45c5923 authorAustin Seipp <aseipp@pobox.com> dateTue 2 Apr 2019, 17:39 (8 years ago) parent536c72a
4 files changed+33−13
pkgs/development/haskell-modules/configuration-common.nix+32−2 pkgs/development/haskell-modules/configuration-hackage2nix.yaml−1 pkgs/development/haskell-modules/hackage-packages.nix−1 pkgs/top-level/all-packages.nix+1−9
pkgs/development/haskell-modules/configuration-common.nix+32−2
@@ -871,8 +871,38 @@ self: super: {
871871 # https://github.com/takano-akio/filelock/issues/5
872872 filelock = dontCheck super.filelock;
873873
874− # cryptol-2.5.0 doesn't want happy 1.19.6+.
875− cryptol = super.cryptol.override { happy = self.happy_1_19_5; };
874+ # fix GHC 8.6 builds by using irrefutable patterns. jailbreak is also
875+ # required due to a constraint failure for base-compat.
876+ cryptol = doJailbreak (overrideCabal super.cryptol (drv: {
877+
878+ # the last patch fixes ghc 8.6 builds; the other two (small) patches fix a
879+ # few bugs between them, but are also hard dependencies
880+ patches = drv.patches or [] ++ [
881+ (pkgs.fetchpatch {
882+ url = https://github.com/GaloisInc/cryptol/commit/634c5a03e757663bf86d1ffad1ce2c6086d4483f.patch;
883+ sha256 = "16dvfihsl2c4jnyfndgrjarkm3z5pyn7rzg2svnidx0qipwrxzm7";
884+ })
885+ (pkgs.fetchpatch {
886+ url = https://github.com/GaloisInc/cryptol/commit/515642328aff6d958ff1b534b9effdd726901b60.patch;
887+ sha256 = "1fml71b720igyh8s7mj1z1c2bbv1vk490iy7blvxp625nymzjij6";
888+ })
889+ (pkgs.fetchpatch {
890+ url = https://github.com/GaloisInc/cryptol/commit/a8eab11b319f6434f9b01b26d419b8305ff30bc2.patch;
891+ sha256 = "1bbznp3kbj8l83q979gf4gr2khwbyqi85ykwsf2jnkhzda6pr0n8";
892+ })
893+ ];
894+
895+ buildTools = drv.buildTools or [] ++ [ pkgs.makeWrapper ];
896+
897+ # make sure the binaries always start up. previously this was in
898+ # all-packages.nix but it's almost certainly better to do it here (e.g. a
899+ # haskell deps may use cryptol in the test suite or something, etc)
900+ postInstall = drv.postInstall or "" + ''
901+ for b in $out/bin/cryptol $out/bin/cryptol-html; do
902+ wrapProgram $b --prefix 'PATH' ':' "${pkgs.lib.getBin pkgs.z3}/bin"
903+ done
904+ '';
905+ }));
876906
877907 # Tests try to invoke external process and process == 1.4
878908 grakn = dontCheck (doJailbreak super.grakn);
pkgs/development/haskell-modules/configuration-hackage2nix.yaml−1
@@ -3788,7 +3788,6 @@ broken-packages:
37883788 - crypto-simple
37893789 - cryptocompare
37903790 - cryptoconditions
3791− - cryptol
37923791 - cryptsy-api
37933792 - crystalfontz
37943793 - cse-ghc-plugin
pkgs/development/haskell-modules/hackage-packages.nix−1
@@ -59113,7 +59113,6 @@ self: {
5911359113 description = "Cryptol: The Language of Cryptography";
5911459114 license = stdenv.lib.licenses.bsd3;
5911559115 hydraPlatforms = stdenv.lib.platforms.none;
59116− broken = true;
5911759116 }) {};
5911859117
5911959118 "cryptonite" = callPackage
pkgs/top-level/all-packages.nix+1−9
@@ -6854,15 +6854,7 @@ in
68546854
68556855 cpp-gsl = callPackage ../development/libraries/cpp-gsl { };
68566856
6857− # Users installing via `nix-env` will likely be using the REPL,
6858− # which has a hard dependency on Z3, so make sure it is available.
6859− cryptol = haskellPackages.cryptol.overrideDerivation (oldAttrs: {
6860− buildInputs = (oldAttrs.buildInputs or []) ++ [ makeWrapper ];
6861− installPhase = (oldAttrs.installPhase or "") + ''
6862− wrapProgram $out/bin/cryptol \
6863− --prefix 'PATH' ':' "${lib.getBin z3}/bin"
6864− '';
6865− });
6857+ cryptol = haskell.lib.justStaticExecutables haskellPackages.cryptol;
68666858
68676859 inherit (callPackages ../development/compilers/crystal {})
68686860 crystal_0_25