From 6d881472ef7c6a592eda36c2783130dc03c678b9 Mon Sep 17 00:00:00 2001 From: Benjamin Hipple Date: Fri, 14 Feb 2020 19:51:05 -0500 Subject: [PATCH] rust: Fix for legacy fetch cargo See inline comment and #79975 for details. --- pkgs/build-support/rust/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index da4d69e1c9e..3fdfc0636f9 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -45,11 +45,17 @@ let # and have vendored deps, check them against the src attr for consistency. validateCargoDeps = cargoSha256 != "unset" && !legacyCargoFetcher; + # Some cargo builds include build hooks that modify their own vendor + # dependencies. This copies the vendor directory into the build tree and makes + # it writable. If we're using a tarball, the unpackFile hook already handles + # this for us automatically. setupVendorDir = if cargoVendorDir == null - then '' + then ('' unpackFile "$cargoDeps" cargoDepsCopy=$(stripHash $cargoDeps) - '' + '' + stdenv.lib.optionalString legacyCargoFetcher '' + chmod -R +w "$cargoDepsCopy" + '') else '' cargoDepsCopy="$sourceRoot/${cargoVendorDir}" '';