git.iko.soy/typeable/nixpkgs
on master help sign in
zcash: 2.1.1-1 -> 4.1.1; fix build

This is pretty much a repackaging, because a lot has changed about zcash in two major versions. Lots of libraries are no longer necessary, and librustzcash is now part of the zcash package as opposed to being a library supposed to be built seperately. The whole thing is a buildRustPackage because that's easier than trying to emulate buildRustPackage's dependency setup behaviour inside a normal mkDerivation. So that the normal zcash build process is followed, the actual configuring and building uses the normal stdenv behaviour.

commit17afca588517687d900386ad3d47eb75e40fec5d authorAlyssa Ross <hi@alyssa.is> dateFri 18 Dec 2020, 02:14 (6 years ago) parent1db8a43
2 files changed+36−53
pkgs/applications/blockchains/zcash/default.nix+36−20 pkgs/applications/blockchains/zcash/librustzcash/default.nix−33
pkgs/applications/blockchains/zcash/default.nix+36−20
@@ -1,39 +1,55 @@
1−{ stdenv, libsodium, fetchFromGitHub, wget, pkgconfig, autoreconfHook, openssl, db62, boost17x
2−, zlib, gtest, gmock, callPackage, gmp, qt4, util-linux, protobuf, qrencode, libevent }:
3−
4−let librustzcash = callPackage ./librustzcash {};
5−in
6−with stdenv.lib;
7−stdenv.mkDerivation rec {
1+{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper
2+, cargo, pkg-config
3+, bash, curl, coreutils, boost17x, db62, libsodium, libevent, utf8cpp, util-linux
4+}:
85
6+rustPlatform.buildRustPackage rec {
97 pname = "zcash";
10− version = "2.1.1-1";
8+ version = "4.1.1";
119
1210 src = fetchFromGitHub {
1311 owner = "zcash";
1412 repo = "zcash";
1513 rev = "v${version}";
16− sha256 = "1g5zlfzfp31my8w8nlg5fncpr2y95iv9fm04x57sjb93rgmjdh5n";
14+ sha256 = "185zrw276g545np0niw5hlhlppkjbf5a1r4rwhnbaimdjdii2dil";
1715 };
1816
19− patchPhase = ''
20− sed -i"" 's,-fvisibility=hidden,,g' src/Makefile.am
21− '';
17+ cargoSha256 = "0qxr6asf8zsya0f1ri39z2cnfpjk96hgwjchz2c7j87vibbvg6dc";
2218
23− nativeBuildInputs = [ autoreconfHook pkgconfig ];
24− buildInputs = [ gtest gmock gmp openssl wget db62 boost17x zlib
25− protobuf libevent libsodium librustzcash ]
26− ++ optionals stdenv.isLinux [ util-linux ];
19+ nativeBuildInputs = [ autoreconfHook cargo makeWrapper pkg-config ];
20+ buildInputs = [ bash boost17x db62 libevent libsodium utf8cpp ];
2721
28− configureFlags = [ "--with-boost-libdir=${boost17x.out}/lib" ];
22+ # Use the stdenv default phases (./configure; make) instead of the
23+ # ones from buildRustPackage.
24+ configurePhase = "configurePhase";
25+ buildPhase = "buildPhase";
26+ checkPhase = "checkPhase";
27+ installPhase = "installPhase";
2928
30− postInstall = ''
31− cp zcutil/fetch-params.sh $out/bin/zcash-fetch-params
29+ postPatch = ''
30+ # Have to do this here instead of in preConfigure because
31+ # cargoDepsCopy gets unset after postPatch.
32+ configureFlagsArray+=("RUST_VENDORED_SOURCES=$NIX_BUILD_TOP/$cargoDepsCopy")
3233 '';
3334
35+ configureFlags = [
36+ "--disable-tests"
37+ "--with-boost-libdir=${lib.getLib boost17x}/lib"
38+ "CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp"
39+ "RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}"
40+ ];
41+
3442 enableParallelBuilding = true;
3543
36− meta = {
44+ # Requires hundreds of megabytes of zkSNARK parameters.
45+ doCheck = false;
46+
47+ postInstall = ''
48+ wrapProgram $out/bin/zcash-fetch-params \
49+ --set PATH ${lib.makeBinPath [ coreutils curl util-linux ]}
50+ '';
51+
52+ meta = with lib; {
3753 description = "Peer-to-peer, anonymous electronic cash system";
3854 homepage = "https://z.cash/";
3955 maintainers = with maintainers; [ rht tkerber ];
pkgs/applications/blockchains/zcash/librustzcash/default.nixdeleted−33
@@ -1,33 +0,0 @@
1−{ stdenv, fetchFromGitHub, rustPlatform }:
2−
3−rustPlatform.buildRustPackage rec {
4− pname = "librustzcash";
5− version = "0.1.0";
6−
7− src = fetchFromGitHub {
8− owner = "zcash";
9− repo = "librustzcash";
10− rev = version;
11− sha256 = "0d28k29sgzrg9clynz29kpw50kbkp0a4dfdayqhmpjmsh05y6261";
12− };
13−
14− cargoSha256 = "1wzyrcmcbrna6rjzw19c4lq30didzk4w6fs6wmvxp0xfg4qqdlax";
15−
16− installPhase = ''
17− mkdir -p $out/lib
18− cp $releaseDir/librustzcash.a $out/lib/
19− mkdir -p $out/include
20− cp librustzcash/include/librustzcash.h $out/include/
21− '';
22−
23− # The tests do pass, but they take an extremely long time to run.
24− doCheck = false;
25−
26− meta = with stdenv.lib; {
27− description = "Rust-language assets for Zcash";
28− homepage = "https://github.com/zcash/librustzcash";
29− maintainers = with maintainers; [ rht tkerber ];
30− license = with licenses; [ mit asl20 ];
31− platforms = platforms.unix;
32− };
33−}