about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/blockchains/zcash
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
commite0794be8a0d11e90461e5a9c85012a36b93ec976 (patch)
treeefd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/applications/blockchains/zcash
parent3538874082ded7647b1ccec0343c7c1e882cfef3 (diff)
parent1a57d96edd156958b12782e8c8b6a374142a7248 (diff)
downloadnixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/applications/blockchains/zcash')
-rw-r--r--nixpkgs/pkgs/applications/blockchains/zcash/default.nix56
-rw-r--r--nixpkgs/pkgs/applications/blockchains/zcash/librustzcash/default.nix33
2 files changed, 36 insertions, 53 deletions
diff --git a/nixpkgs/pkgs/applications/blockchains/zcash/default.nix b/nixpkgs/pkgs/applications/blockchains/zcash/default.nix
index e2c57d514cda..6a8bebf6178e 100644
--- a/nixpkgs/pkgs/applications/blockchains/zcash/default.nix
+++ b/nixpkgs/pkgs/applications/blockchains/zcash/default.nix
@@ -1,39 +1,55 @@
-{ stdenv, libsodium, fetchFromGitHub, wget, pkgconfig, autoreconfHook, openssl, db62, boost17x
-, zlib, gtest, gmock, callPackage, gmp, qt4, utillinux, protobuf, qrencode, libevent }:
-
-let librustzcash = callPackage ./librustzcash {};
-in
-with stdenv.lib;
-stdenv.mkDerivation rec {
+{ rust, rustPlatform, stdenv, lib, fetchFromGitHub, autoreconfHook, makeWrapper
+, cargo, pkg-config
+, bash, curl, coreutils, boost17x, db62, libsodium, libevent, utf8cpp, util-linux
+}:
 
+rustPlatform.buildRustPackage rec {
   pname = "zcash";
-  version = "2.1.1-1";
+  version = "4.1.1";
 
   src = fetchFromGitHub {
     owner = "zcash";
     repo  = "zcash";
     rev = "v${version}";
-    sha256 = "1g5zlfzfp31my8w8nlg5fncpr2y95iv9fm04x57sjb93rgmjdh5n";
+    sha256 = "185zrw276g545np0niw5hlhlppkjbf5a1r4rwhnbaimdjdii2dil";
   };
 
-  patchPhase = ''
-    sed -i"" 's,-fvisibility=hidden,,g'            src/Makefile.am
-  '';
+  cargoSha256 = "0qxr6asf8zsya0f1ri39z2cnfpjk96hgwjchz2c7j87vibbvg6dc";
 
-  nativeBuildInputs = [ autoreconfHook pkgconfig ];
-  buildInputs = [ gtest gmock gmp openssl wget db62 boost17x zlib
-                  protobuf libevent libsodium librustzcash ]
-                  ++ optionals stdenv.isLinux [ utillinux ];
+  nativeBuildInputs = [ autoreconfHook cargo makeWrapper pkg-config ];
+  buildInputs = [ bash boost17x db62 libevent libsodium utf8cpp ];
 
-  configureFlags = [ "--with-boost-libdir=${boost17x.out}/lib" ];
+  # Use the stdenv default phases (./configure; make) instead of the
+  # ones from buildRustPackage.
+  configurePhase = "configurePhase";
+  buildPhase = "buildPhase";
+  checkPhase = "checkPhase";
+  installPhase = "installPhase";
 
-  postInstall = ''
-    cp zcutil/fetch-params.sh $out/bin/zcash-fetch-params
+  postPatch = ''
+    # Have to do this here instead of in preConfigure because
+    # cargoDepsCopy gets unset after postPatch.
+    configureFlagsArray+=("RUST_VENDORED_SOURCES=$NIX_BUILD_TOP/$cargoDepsCopy")
   '';
 
+  configureFlags = [
+    "--disable-tests"
+    "--with-boost-libdir=${lib.getLib boost17x}/lib"
+    "CXXFLAGS=-I${lib.getDev utf8cpp}/include/utf8cpp"
+    "RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}"
+  ];
+
   enableParallelBuilding = true;
 
-  meta = {
+  # 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; {
     description = "Peer-to-peer, anonymous electronic cash system";
     homepage = "https://z.cash/";
     maintainers = with maintainers; [ rht tkerber ];
diff --git a/nixpkgs/pkgs/applications/blockchains/zcash/librustzcash/default.nix b/nixpkgs/pkgs/applications/blockchains/zcash/librustzcash/default.nix
deleted file mode 100644
index 526adc715d45..000000000000
--- a/nixpkgs/pkgs/applications/blockchains/zcash/librustzcash/default.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ stdenv, fetchFromGitHub, rustPlatform }:
-
-rustPlatform.buildRustPackage rec {
-  pname = "librustzcash";
-  version = "0.1.0";
-
-  src = fetchFromGitHub {
-    owner = "zcash";
-    repo = "librustzcash";
-    rev = version;
-    sha256 = "0d28k29sgzrg9clynz29kpw50kbkp0a4dfdayqhmpjmsh05y6261";
-  };
-
-  cargoSha256 = "1wzyrcmcbrna6rjzw19c4lq30didzk4w6fs6wmvxp0xfg4qqdlax";
-
-  installPhase = ''
-    mkdir -p $out/lib
-    cp $releaseDir/librustzcash.a $out/lib/
-    mkdir -p $out/include
-    cp librustzcash/include/librustzcash.h $out/include/
-  '';
-
-  # The tests do pass, but they take an extremely long time to run.
-  doCheck = false;
-
-  meta = with stdenv.lib; {
-    description = "Rust-language assets for Zcash";
-    homepage = "https://github.com/zcash/librustzcash";
-    maintainers = with maintainers; [ rht tkerber ];
-    license = with licenses; [ mit asl20 ];
-    platforms = platforms.unix;
-  };
-}