2020-12-26 04:20:00 +00:00
|
|
|
{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper
|
|
|
|
, cargo, pkg-config
|
|
|
|
, bash, curl, coreutils, boost17x, db62, libsodium, libevent, utf8cpp, util-linux
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "zcash";
|
2020-12-26 04:20:00 +00:00
|
|
|
version = "4.1.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zcash";
|
|
|
|
repo = "zcash";
|
|
|
|
rev = "v${version}";
|
2020-12-26 04:20:00 +00:00
|
|
|
sha256 = "185zrw276g545np0niw5hlhlppkjbf5a1r4rwhnbaimdjdii2dil";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
cargoSha256 = "0qxr6asf8zsya0f1ri39z2cnfpjk96hgwjchz2c7j87vibbvg6dc";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook cargo makeWrapper pkg-config ];
|
|
|
|
buildInputs = [ bash boost17x db62 libevent libsodium utf8cpp ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
# Use the stdenv default phases (./configure; make) instead of the
|
|
|
|
# ones from buildRustPackage.
|
|
|
|
configurePhase = "configurePhase";
|
|
|
|
buildPhase = "buildPhase";
|
|
|
|
checkPhase = "checkPhase";
|
|
|
|
installPhase = "installPhase";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-26 04:20:00 +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")
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-tests"
|
|
|
|
"--with-boost-libdir=${lib.getLib boost17x}/lib"
|
|
|
|
"CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp"
|
|
|
|
"RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-12-26 04:20:00 +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; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Peer-to-peer, anonymous electronic cash system";
|
|
|
|
homepage = "https://z.cash/";
|
|
|
|
maintainers = with maintainers; [ rht tkerber ];
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|