mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 10:53:11 +00:00
e3e57b8f18
We need this stuff to be available in lib so make-derivation.nix can access it to construct the Meson cross file. This has a couple of other advantages: - It makes Rust less special. Now figuring out what Rust calls a platform is the same as figuring out what Linux or QEMU call it. - We can unify the schema used to define Rust targets, and the schema used to access those values later. Just like you can set "config" or "system" in a platform definition, and then access those same keys on the elaborated platform, you can now set "rustcTarget" in your crossSystem, and then access "stdenv.hostPlatform.rustcTarget" in your code. "rustcTarget", "rustcTargetSpec", "cargoShortTarget", and "cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because these are not exposed to code by the compiler, and are not standardized. The arch/os/etc. variables are all named to match the forms in the Rust target spec JSON. The new rust.target-family only takes a list, since we don't need to worry about backwards compatibility when that name is used. The old APIs are all still functional with no warning for now, so that it's possible for external code to use a single API on both 23.05 and 23.11. We can introduce the warnings once 23.05 is EOL, and make them hard errors when 23.11 is EOL.
89 lines
2.4 KiB
Nix
89 lines
2.4 KiB
Nix
{ autoreconfHook, boost180, cargo, coreutils, curl, cxx-rs, db62, fetchFromGitHub
|
|
, git, hexdump, lib, libevent, libsodium, makeWrapper, rustPlatform
|
|
, pkg-config, Security, stdenv, testers, tl-expected, utf8cpp, util-linux, zcash, zeromq
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
|
|
pname = "zcash";
|
|
version = "5.4.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "zcash";
|
|
repo = "zcash";
|
|
rev = "v${version}";
|
|
hash = "sha256-XGq/cYUo43FcpmRDO2YiNLCuEQLsTFLBFC4M1wM29l8=";
|
|
};
|
|
|
|
prePatch = lib.optionalString stdenv.isAarch64 ''
|
|
substituteInPlace .cargo/config.offline \
|
|
--replace "[target.aarch64-unknown-linux-gnu]" "" \
|
|
--replace "linker = \"aarch64-linux-gnu-gcc\"" ""
|
|
'';
|
|
|
|
cargoHash = "sha256-Mz8mr/RDcOfwJvXhY19rZmWHP8mUeEf9GYD+3JAPNOw=";
|
|
|
|
nativeBuildInputs = [ autoreconfHook cargo cxx-rs git hexdump makeWrapper pkg-config ];
|
|
|
|
buildInputs = [
|
|
boost180
|
|
db62
|
|
libevent
|
|
libsodium
|
|
tl-expected
|
|
utf8cpp
|
|
zeromq
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
Security
|
|
];
|
|
|
|
# Use the stdenv default phases (./configure; make) instead of the
|
|
# ones from buildRustPackage.
|
|
configurePhase = "configurePhase";
|
|
buildPhase = "buildPhase";
|
|
checkPhase = "checkPhase";
|
|
installPhase = "installPhase";
|
|
|
|
postPatch = ''
|
|
# Have to do this here instead of in preConfigure because
|
|
# cargoDepsCopy gets unset after postPatch.
|
|
configureFlagsArray+=("RUST_VENDORED_SOURCES=$cargoDepsCopy")
|
|
'';
|
|
|
|
CXXFLAGS = [
|
|
"-I${lib.getDev utf8cpp}/include/utf8cpp"
|
|
"-I${lib.getDev cxx-rs}/include"
|
|
];
|
|
|
|
configureFlags = [
|
|
"--disable-tests"
|
|
"--with-boost-libdir=${lib.getLib boost180}/lib"
|
|
"RUST_TARGET=${stdenv.hostPlatform.rust.rustcTargetSpec}"
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
# Requires hundreds of megabytes of zkSNARK parameters.
|
|
doCheck = false;
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = zcash;
|
|
command = "zcashd --version";
|
|
version = "v${zcash.version}";
|
|
};
|
|
|
|
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 centromere ];
|
|
license = licenses.mit;
|
|
|
|
# https://github.com/zcash/zcash/issues/4405
|
|
broken = stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin;
|
|
};
|
|
}
|