diff --git a/pkgs/applications/blockchains/zcash/default.nix b/pkgs/applications/blockchains/zcash/default.nix index 1706bcd888d7..2db86c9581a6 100644 --- a/pkgs/applications/blockchains/zcash/default.nix +++ b/pkgs/applications/blockchains/zcash/default.nix @@ -13,6 +13,7 @@ libevent, libsodium, makeWrapper, + rustc, rustPlatform, pkg-config, Security, @@ -25,7 +26,7 @@ zeromq, }: -rustPlatform.buildRustPackage.override { inherit stdenv; } rec { +stdenv.mkDerivation rec { pname = "zcash"; version = "5.4.2"; @@ -36,14 +37,16 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec { hash = "sha256-XGq/cYUo43FcpmRDO2YiNLCuEQLsTFLBFC4M1wM29l8="; }; - prePatch = lib.optionalString stdenv.hostPlatform.isAarch64 '' - substituteInPlace .cargo/config.offline \ - --replace "[target.aarch64-unknown-linux-gnu]" "" \ - --replace "linker = \"aarch64-linux-gnu-gcc\"" "" - ''; + patches = [ + # upstream has a custom way of specifying a cargo vendor-directory + # we'll remove that logic, since cargoSetupHook from nixpkgs works better + ./dont-use-custom-vendoring-logic.patch + ]; - useFetchCargoVendor = true; - cargoHash = "sha256-VBqasLpxqI4kr73Mr7OVuwb2OIhUwnY9CTyZZOyEElU="; + cargoDeps = rustPlatform.fetchCargoVendor { + inherit pname version src; + hash = "sha256-VBqasLpxqI4kr73Mr7OVuwb2OIhUwnY9CTyZZOyEElU="; + }; nativeBuildInputs = [ autoreconfHook @@ -53,6 +56,8 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec { hexdump makeWrapper pkg-config + rustc + rustPlatform.cargoSetupHook ]; buildInputs = @@ -69,19 +74,6 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec { Security ]; - # Use the stdenv default phases (./configure; make) instead of the - # ones from buildRustPackage. - configurePhase = "configurePhase"; - dontCargoBuild = true; - dontCargoCheck = true; - dontCargoInstall = true; - - 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" diff --git a/pkgs/applications/blockchains/zcash/dont-use-custom-vendoring-logic.patch b/pkgs/applications/blockchains/zcash/dont-use-custom-vendoring-logic.patch new file mode 100644 index 000000000000..0096b4932293 --- /dev/null +++ b/pkgs/applications/blockchains/zcash/dont-use-custom-vendoring-logic.patch @@ -0,0 +1,16 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 8b14284..e614755 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -121,10 +121,7 @@ else + RUST_BUILD_OPTS += --locked --offline + + CARGO_CONFIGURED = $(top_srcdir)/.cargo/.configured-for-offline +-$(CARGO_CONFIGURED): $(top_srcdir)/.cargo/config.offline +- $(AM_V_at)rm -f $(top_srcdir)/.cargo/.configured-for-online +- $(AM_V_at)cp $< $(top_srcdir)/.cargo/config +- $(AM_V_at)echo "directory = \"$(RUST_VENDORED_SOURCES)\"" >>$(top_srcdir)/.cargo/config ++$(CARGO_CONFIGURED): + $(AM_V_at)touch $@ + endif + if ENABLE_SHANI