diff options
Diffstat (limited to 'pkgs/applications/blockchains/zcash/default.nix')
-rw-r--r-- | pkgs/applications/blockchains/zcash/default.nix | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/pkgs/applications/blockchains/zcash/default.nix b/pkgs/applications/blockchains/zcash/default.nix index e2c57d514cd..298b678a316 100644 --- a/pkgs/applications/blockchains/zcash/default.nix +++ b/pkgs/applications/blockchains/zcash/default.nix @@ -1,39 +1,61 @@ -{ stdenv, libsodium, fetchFromGitHub, wget, pkgconfig, autoreconfHook, openssl, db62, boost17x -, zlib, gtest, gmock, callPackage, gmp, qt4, utillinux, protobuf, qrencode, libevent }: - -let librustzcash = callPackage ./librustzcash {}; -in -with stdenv.lib; -stdenv.mkDerivation rec { +{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper +, cargo, pkg-config, curl, coreutils, boost174, db62, hexdump, libsodium +, libevent, utf8cpp, util-linux, withDaemon ? true, withMining ? true +, withUtils ? true, withWallet ? true, withZmq ? true, zeromq +}: +rustPlatform.buildRustPackage.override { stdenv = stdenv; } rec { pname = "zcash"; - version = "2.1.1-1"; + version = "4.4.1"; src = fetchFromGitHub { owner = "zcash"; repo = "zcash"; rev = "v${version}"; - sha256 = "1g5zlfzfp31my8w8nlg5fncpr2y95iv9fm04x57sjb93rgmjdh5n"; + sha256 = "0nhrjizx518khrl8aygag6a1ianzzqpchasggi963f807kv7ipb7"; }; - patchPhase = '' - sed -i"" 's,-fvisibility=hidden,,g' src/Makefile.am - ''; + cargoSha256 = "101j8cn2lg3l1gn53yg3svzwx783z331g9kzn9ici4azindyx903"; - nativeBuildInputs = [ autoreconfHook pkgconfig ]; - buildInputs = [ gtest gmock gmp openssl wget db62 boost17x zlib - protobuf libevent libsodium librustzcash ] - ++ optionals stdenv.isLinux [ utillinux ]; + nativeBuildInputs = [ autoreconfHook cargo hexdump makeWrapper pkg-config ]; + buildInputs = [ boost174 libevent libsodium utf8cpp ] + ++ lib.optional withWallet db62 + ++ lib.optional withZmq zeromq; - configureFlags = [ "--with-boost-libdir=${boost17x.out}/lib" ]; + # Use the stdenv default phases (./configure; make) instead of the + # ones from buildRustPackage. + configurePhase = "configurePhase"; + buildPhase = "buildPhase"; + checkPhase = "checkPhase"; + installPhase = "installPhase"; - postInstall = '' - cp zcutil/fetch-params.sh $out/bin/zcash-fetch-params + postPatch = '' + # Have to do this here instead of in preConfigure because + # cargoDepsCopy gets unset after postPatch. + configureFlagsArray+=("RUST_VENDORED_SOURCES=$NIX_BUILD_TOP/$cargoDepsCopy") ''; + configureFlags = [ + "--disable-tests" + "--with-boost-libdir=${lib.getLib boost174}/lib" + "CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp" + "RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}" + ] ++ lib.optional (!withWallet) "--disable-wallet" + ++ lib.optional (!withDaemon) "--without-daemon" + ++ lib.optional (!withUtils) "--without-utils" + ++ lib.optional (!withMining) "--disable-mining"; + enableParallelBuilding = true; - meta = { + # Requires hundreds of megabytes of zkSNARK parameters. + doCheck = false; + + postInstall = '' + wrapProgram $out/bin/zcash-fetch-params \ + --set PATH ${lib.makeBinPath [ coreutils curl util-linux ]} + ''; + + meta = with lib; { description = "Peer-to-peer, anonymous electronic cash system"; homepage = "https://z.cash/"; maintainers = with maintainers; [ rht tkerber ]; |