2022-08-12 12:06:08 +00:00
|
|
|
{ autoreconfHook, boost179, cargo, coreutils, curl, cxx-rs, db62, fetchFromGitHub
|
|
|
|
, hexdump, lib, libevent, libsodium, makeWrapper, rust, rustPlatform, pkg-config
|
|
|
|
, stdenv, testers, utf8cpp, util-linux, zcash, zeromq
|
2020-12-26 04:20:00 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "zcash";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "5.1.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zcash";
|
|
|
|
repo = "zcash";
|
|
|
|
rev = "v${version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-tU6DuWpe8Vlx0qIilAKWuO7WFp1ucbxtvOxoWLA0gdc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
prePatch = lib.optionalString stdenv.isAarch64 ''
|
|
|
|
substituteInPlace .cargo/config.offline \
|
|
|
|
--replace "[target.aarch64-unknown-linux-gnu]" "" \
|
|
|
|
--replace "linker = \"aarch64-linux-gnu-gcc\"" ""
|
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
|
|
|
./patches/fix-missing-header.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cargoSha256 = "sha256-ZWmkveDEENdXRirGmnUWSjtPNJvX0Jpgfxhzk44F7Q0=";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook cargo cxx-rs hexdump makeWrapper pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ boost179 db62 libevent libsodium utf8cpp zeromq ];
|
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
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
CXXFLAGS = [
|
|
|
|
"-I${lib.getDev utf8cpp}/include/utf8cpp"
|
|
|
|
"-I${lib.getDev cxx-rs}/include"
|
|
|
|
];
|
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-tests"
|
2022-05-18 14:49:53 +00:00
|
|
|
"--with-boost-libdir=${lib.getLib boost179}/lib"
|
2020-12-26 04:20:00 +00:00
|
|
|
"RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}"
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
2020-12-26 04:20:00 +00:00
|
|
|
|
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;
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = zcash;
|
|
|
|
command = "zcashd --version";
|
|
|
|
version = "v${zcash.version}";
|
|
|
|
};
|
|
|
|
|
2020-12-26 04:20:00 +00:00
|
|
|
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/";
|
2022-05-18 14:49:53 +00:00
|
|
|
maintainers = with maintainers; [ rht tkerber centromere ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|