1{ lib
2, rustPlatform
3, fetchCrate
4, stdenv
5, darwin
6, fetchpatch
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "kind2";
11 version = "0.3.10";
12
13 src = fetchCrate {
14 inherit pname version;
15 hash = "sha256-X2sjfYrSSym289jDJV3hNmcwyQCMnrabmGCUKD5wfdY=";
16 };
17
18 cargoHash = "sha256-KzoEh/kMKsHx9K3t1/uQZ7fdsZEM+v8UOft8JjEB1Zw=";
19
20 buildInputs = lib.optionals stdenv.isDarwin [
21 darwin.apple_sdk_11_0.frameworks.Security
22 ];
23
24 postPatch =
25 let
26 hvmPatch = fetchpatch {
27 name = "revert-fix-remove-feature-automic-mut-ptr.patch";
28 url = "https://github.com/higherorderco/hvm/commit/c0e35c79b4e31c266ad33beadc397c428e4090ee.patch";
29 hash = "sha256-9xxu7NOtz3Tuzf5F0Mi4rw45Xnyh7h9hbTrzq4yfslg=";
30 revert = true;
31 };
32 in
33 ''
34 pushd $cargoDepsCopy/hvm
35
36 oldLibHash=$(sha256sum src/lib.rs | cut -d " " -f 1)
37 oldMainHash=$(sha256sum src/main.rs | cut -d " " -f 1)
38
39 patch -p1 < ${hvmPatch}
40
41 newLibHash=$(sha256sum src/lib.rs | cut -d " " -f 1)
42 newMainHash=$(sha256sum src/main.rs | cut -d " " -f 1)
43
44 substituteInPlace .cargo-checksum.json \
45 --replace "$oldLibHash" "$newLibHash" \
46 --replace "$oldMainHash" "$newMainHash"
47
48 popd
49 '';
50
51 # requires nightly features
52 RUSTC_BOOTSTRAP = true;
53
54 meta = with lib; {
55 description = "A functional programming language and proof assistant";
56 homepage = "https://github.com/higherorderco/kind";
57 license = licenses.mit;
58 maintainers = with maintainers; [ figsoda ];
59 };
60}