about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2020-02-14 19:51:05 -0500
committerJon <jonringer@users.noreply.github.com>2020-02-15 17:41:35 -0800
commit6d881472ef7c6a592eda36c2783130dc03c678b9 (patch)
tree1964be5e2c053ed0c1235e0a2888401db8024346 /pkgs
parent4c900027b135786fa021513af3bd2485d6420114 (diff)
downloadnixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar.gz
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar.bz2
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar.lz
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar.xz
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.tar.zst
nixlib-6d881472ef7c6a592eda36c2783130dc03c678b9.zip
rust: Fix for legacy fetch cargo
See inline comment and #79975 for details.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/rust/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index da4d69e1c9ed..3fdfc0636f94 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}"
     '';