about summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-03-03 19:40:55 -0500
committerGitHub <noreply@github.com>2023-03-03 19:40:55 -0500
commiteedbf71d0df33d54e76f87469b82e4feb1737c2e (patch)
treeb117b46ebd6ec09f48c576d86650c2c70bc1d04b /pkgs/build-support/rust
parentf3b63ce3c3578638113c4bcbdd291eb358f823bd (diff)
parent3e18607be38fe5294fc4773220f25452ce0b7f9f (diff)
Merge pull request #218472 from figsoda/cargo-setup
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r--pkgs/build-support/rust/hooks/cargo-setup-hook.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
index bdd9db8766fa7..693c0b08759ea 100644
--- a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
+++ b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
@@ -6,7 +6,13 @@ cargoSetupPostUnpackHook() {
     # it writable. If we're using a tarball, the unpackFile hook already handles
     # this for us automatically.
     if [ -z $cargoVendorDir ]; then
-        unpackFile "$cargoDeps"
+        if [ -d "$cargoDeps" ]; then
+            local dest=$(stripHash "$cargoDeps")
+            cp -Lr --reflink=auto -- "$cargoDeps" "$dest"
+            chmod -R +644 -- "$dest"
+        else
+            unpackFile "$cargoDeps"
+        fi
         export cargoDepsCopy="$(realpath "$(stripHash $cargoDeps)")"
     else
         cargoDepsCopy="$(realpath "$(pwd)/$sourceRoot/${cargoRoot:+$cargoRoot/}${cargoVendorDir}")"