nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 autoreconfHook,
3 boost,
4 cargo,
5 coreutils,
6 curl,
7 cxx-rs,
8 db62,
9 fetchFromGitHub,
10 gitMinimal,
11 hexdump,
12 lib,
13 libevent,
14 libsodium,
15 makeWrapper,
16 rustc,
17 rustPlatform,
18 pkg-config,
19 stdenv,
20 testers,
21 tl-expected,
22 utf8cpp,
23 util-linux,
24 zcash,
25 zeromq,
26}:
27
28stdenv.mkDerivation rec {
29 pname = "zcash";
30 version = "5.4.2";
31
32 src = fetchFromGitHub {
33 owner = "zcash";
34 repo = "zcash";
35 rev = "v${version}";
36 hash = "sha256-XGq/cYUo43FcpmRDO2YiNLCuEQLsTFLBFC4M1wM29l8=";
37 };
38
39 patches = [
40 # upstream has a custom way of specifying a cargo vendor-directory
41 # we'll remove that logic, since cargoSetupHook from nixpkgs works better
42 ./dont-use-custom-vendoring-logic.patch
43 ];
44
45 cargoDeps = rustPlatform.fetchCargoVendor {
46 inherit pname version src;
47 hash = "sha256-VBqasLpxqI4kr73Mr7OVuwb2OIhUwnY9CTyZZOyEElU=";
48 };
49
50 nativeBuildInputs = [
51 autoreconfHook
52 cargo
53 cxx-rs
54 gitMinimal
55 hexdump
56 makeWrapper
57 pkg-config
58 rustc
59 rustPlatform.cargoSetupHook
60 ];
61
62 buildInputs = [
63 boost
64 db62
65 libevent
66 libsodium
67 tl-expected
68 utf8cpp
69 zeromq
70 ];
71
72 CXXFLAGS = [
73 "-I${lib.getDev utf8cpp}/include/utf8cpp"
74 "-I${lib.getDev cxx-rs}/include"
75 ];
76
77 configureFlags = [
78 "--disable-tests"
79 "--with-boost-libdir=${lib.getLib boost}/lib"
80 "RUST_TARGET=${stdenv.hostPlatform.rust.rustcTargetSpec}"
81 ];
82
83 enableParallelBuilding = true;
84
85 # Requires hundreds of megabytes of zkSNARK parameters.
86 doCheck = false;
87
88 passthru.tests.version = testers.testVersion {
89 package = zcash;
90 command = "zcashd --version";
91 version = "v${zcash.version}";
92 };
93
94 postInstall = ''
95 wrapProgram $out/bin/zcash-fetch-params \
96 --set PATH ${
97 lib.makeBinPath [
98 coreutils
99 curl
100 util-linux
101 ]
102 }
103 '';
104
105 meta = with lib; {
106 description = "Peer-to-peer, anonymous electronic cash system";
107 homepage = "https://z.cash/";
108 maintainers = with maintainers; [
109 rht
110 tkerber
111 centromere
112 ];
113 license = licenses.mit;
114
115 # https://github.com/zcash/zcash/issues/4405
116 broken = stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin;
117 };
118}