|
1 | | -{ stdenv, libsodium, fetchFromGitHub, wget, pkgconfig, autoreconfHook, openssl, db62, boost17x |
2 | | -, zlib, gtest, gmock, callPackage, gmp, qt4, util-linux, protobuf, qrencode, libevent }: |
3 | | - |
4 | | -let librustzcash = callPackage ./librustzcash {}; |
5 | | -in |
6 | | -with stdenv.lib; |
7 | | -stdenv.mkDerivation rec { |
| 1 | +{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper |
| 2 | +, cargo, pkg-config |
| 3 | +, bash, curl, coreutils, boost17x, db62, libsodium, libevent, utf8cpp, util-linux |
| 4 | +}: |
8 | 5 |
|
| 6 | +rustPlatform.buildRustPackage rec { |
9 | 7 | pname = "zcash"; |
10 | | - version = "2.1.1-1"; |
| 8 | + version = "4.1.1"; |
11 | 9 |
|
12 | 10 | src = fetchFromGitHub { |
13 | 11 | owner = "zcash"; |
14 | 12 | repo = "zcash"; |
15 | 13 | rev = "v${version}"; |
16 | | - sha256 = "1g5zlfzfp31my8w8nlg5fncpr2y95iv9fm04x57sjb93rgmjdh5n"; |
| 14 | + sha256 = "185zrw276g545np0niw5hlhlppkjbf5a1r4rwhnbaimdjdii2dil"; |
17 | 15 | }; |
18 | 16 |
|
19 | | - patchPhase = '' |
20 | | - sed -i"" 's,-fvisibility=hidden,,g' src/Makefile.am |
21 | | - ''; |
| 17 | + cargoSha256 = "0qxr6asf8zsya0f1ri39z2cnfpjk96hgwjchz2c7j87vibbvg6dc"; |
22 | 18 |
|
23 | | - nativeBuildInputs = [ autoreconfHook pkgconfig ]; |
24 | | - buildInputs = [ gtest gmock gmp openssl wget db62 boost17x zlib |
25 | | - protobuf libevent libsodium librustzcash ] |
26 | | - ++ optionals stdenv.isLinux [ util-linux ]; |
| 19 | + nativeBuildInputs = [ autoreconfHook cargo makeWrapper pkg-config ]; |
| 20 | + buildInputs = [ bash boost17x db62 libevent libsodium utf8cpp ]; |
27 | 21 |
|
28 | | - configureFlags = [ "--with-boost-libdir=${boost17x.out}/lib" ]; |
| 22 | + # Use the stdenv default phases (./configure; make) instead of the |
| 23 | + # ones from buildRustPackage. |
| 24 | + configurePhase = "configurePhase"; |
| 25 | + buildPhase = "buildPhase"; |
| 26 | + checkPhase = "checkPhase"; |
| 27 | + installPhase = "installPhase"; |
29 | 28 |
|
30 | | - postInstall = '' |
31 | | - cp zcutil/fetch-params.sh $out/bin/zcash-fetch-params |
| 29 | + postPatch = '' |
| 30 | + # Have to do this here instead of in preConfigure because |
| 31 | + # cargoDepsCopy gets unset after postPatch. |
| 32 | + configureFlagsArray+=("RUST_VENDORED_SOURCES=$NIX_BUILD_TOP/$cargoDepsCopy") |
32 | 33 | ''; |
33 | 34 |
|
| 35 | + configureFlags = [ |
| 36 | + "--disable-tests" |
| 37 | + "--with-boost-libdir=${lib.getLib boost17x}/lib" |
| 38 | + "CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp" |
| 39 | + "RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}" |
| 40 | + ]; |
| 41 | + |
34 | 42 | enableParallelBuilding = true; |
35 | 43 |
|
36 | | - meta = { |
| 44 | + # Requires hundreds of megabytes of zkSNARK parameters. |
| 45 | + doCheck = false; |
| 46 | + |
| 47 | + postInstall = '' |
| 48 | + wrapProgram $out/bin/zcash-fetch-params \ |
| 49 | + --set PATH ${lib.makeBinPath [ coreutils curl util-linux ]} |
| 50 | + ''; |
| 51 | + |
| 52 | + meta = with lib; { |
37 | 53 | description = "Peer-to-peer, anonymous electronic cash system"; |
38 | 54 | homepage = "https://z.cash/"; |
39 | 55 | maintainers = with maintainers; [ rht tkerber ]; |
|
0 commit comments