2020-12-18 02:14:25 +00:00
|
|
|
{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper
|
2021-09-27 19:38:20 +01:00
|
|
|
, cargo, pkg-config, curl, coreutils, boost175, db62, hexdump, libsodium
|
2021-04-16 00:25:59 +01:00
|
|
|
, libevent, utf8cpp, util-linux, withDaemon ? true, withMining ? true
|
|
|
|
, withUtils ? true, withWallet ? true, withZmq ? true, zeromq
|
2020-12-18 02:14:25 +00:00
|
|
|
}:
|
2017-03-17 09:53:11 +00:00
|
|
|
|
2021-03-14 17:43:48 +00:00
|
|
|
rustPlatform.buildRustPackage.override { stdenv = stdenv; } rec {
|
2019-11-13 14:40:36 +00:00
|
|
|
pname = "zcash";
|
2021-09-30 02:53:44 +01:00
|
|
|
version = "4.5.1";
|
2017-03-17 09:53:11 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zcash";
|
|
|
|
repo = "zcash";
|
2017-08-22 04:29:17 +01:00
|
|
|
rev = "v${version}";
|
2021-09-30 02:53:44 +01:00
|
|
|
sha256 = "0kyk3hv1y13b3vwg9kjcrpvz9v3l8lp0ikj977nykd5ms8b1rifa";
|
2017-03-17 09:53:11 +00:00
|
|
|
};
|
|
|
|
|
2021-09-30 02:53:44 +01:00
|
|
|
cargoSha256 = "1mwprsg74xv6qlxf00w7xapnkisb1aid9hkyr8r90zcwdcy8783r";
|
2020-03-07 16:50:03 +00:00
|
|
|
|
2021-03-14 17:43:48 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook cargo hexdump makeWrapper pkg-config ];
|
2021-09-27 19:38:20 +01:00
|
|
|
buildInputs = [ boost175 libevent libsodium utf8cpp ]
|
2021-04-16 00:25:59 +01:00
|
|
|
++ lib.optional withWallet db62
|
|
|
|
++ lib.optional withZmq zeromq;
|
2017-03-17 09:53:11 +00:00
|
|
|
|
2020-12-18 02:14:25 +00:00
|
|
|
# Use the stdenv default phases (./configure; make) instead of the
|
|
|
|
# ones from buildRustPackage.
|
|
|
|
configurePhase = "configurePhase";
|
|
|
|
buildPhase = "buildPhase";
|
|
|
|
checkPhase = "checkPhase";
|
|
|
|
installPhase = "installPhase";
|
2017-03-17 09:53:11 +00:00
|
|
|
|
2020-12-18 02:14:25 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Have to do this here instead of in preConfigure because
|
|
|
|
# cargoDepsCopy gets unset after postPatch.
|
|
|
|
configureFlagsArray+=("RUST_VENDORED_SOURCES=$NIX_BUILD_TOP/$cargoDepsCopy")
|
2017-03-17 09:53:11 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-18 02:14:25 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-tests"
|
2021-09-27 19:38:20 +01:00
|
|
|
"--with-boost-libdir=${lib.getLib boost175}/lib"
|
2020-12-18 02:14:25 +00:00
|
|
|
"CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp"
|
|
|
|
"RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}"
|
2021-03-14 17:43:48 +00:00
|
|
|
] ++ lib.optional (!withWallet) "--disable-wallet"
|
|
|
|
++ lib.optional (!withDaemon) "--without-daemon"
|
2021-04-16 00:25:59 +01:00
|
|
|
++ lib.optional (!withUtils) "--without-utils"
|
|
|
|
++ lib.optional (!withMining) "--disable-mining";
|
2020-12-18 02:14:25 +00:00
|
|
|
|
2020-03-07 16:50:03 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-12-18 02:14:25 +00:00
|
|
|
# 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; {
|
2017-03-17 09:53:11 +00:00
|
|
|
description = "Peer-to-peer, anonymous electronic cash system";
|
2020-03-07 16:50:03 +00:00
|
|
|
homepage = "https://z.cash/";
|
2019-11-13 14:40:36 +00:00
|
|
|
maintainers = with maintainers; [ rht tkerber ];
|
2017-03-17 09:53:11 +00:00
|
|
|
license = licenses.mit;
|
2017-11-24 11:23:01 +00:00
|
|
|
platforms = platforms.linux;
|
2017-03-17 09:53:11 +00:00
|
|
|
};
|
|
|
|
}
|