@@ -1,39 +1,55 @@
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+}:
85
6+rustPlatform.buildRustPackage rec {
97 pname = "zcash";
10− version = "2.1.1-1";
8+ version = "4.1.1";
119
1210 src = fetchFromGitHub {
1311 owner = "zcash";
1412 repo = "zcash";
1513 rev = "v${version}";
16− sha256 = "1g5zlfzfp31my8w8nlg5fncpr2y95iv9fm04x57sjb93rgmjdh5n";
14+ sha256 = "185zrw276g545np0niw5hlhlppkjbf5a1r4rwhnbaimdjdii2dil";
1715 };
1816
19− patchPhase = ''
20− sed -i"" 's,-fvisibility=hidden,,g' src/Makefile.am
21− '';
17+ cargoSha256 = "0qxr6asf8zsya0f1ri39z2cnfpjk96hgwjchz2c7j87vibbvg6dc";
2218
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 ];
2721
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";
2928
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")
3233 '';
3334
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+
3442 enableParallelBuilding = true;
3543
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; {
3753 description = "Peer-to-peer, anonymous electronic cash system";
3854 homepage = "https://z.cash/";
3955 maintainers = with maintainers; [ rht tkerber ];