diff options
author | figsoda <figsoda@pm.me> | 2023-02-26 11:51:55 -0500 |
---|---|---|
committer | figsoda <figsoda@pm.me> | 2023-02-26 11:55:50 -0500 |
commit | 3e18607be38fe5294fc4773220f25452ce0b7f9f (patch) | |
tree | 1e09e85597e4c9ea983390841d013212961de20b /pkgs/build-support/rust/hooks | |
parent | e5fb0c0c7236189f651dc607043592b405676617 (diff) |
rustPlatform.cargoSetupHook: dereference symlinks in cargoDeps
unpackFile doesn't dereference symlinks if cargoDeps is a directory, and some cargo builds run into permission issues because the files the symlinks point to are not writable.
Diffstat (limited to 'pkgs/build-support/rust/hooks')
-rw-r--r-- | pkgs/build-support/rust/hooks/cargo-setup-hook.sh | 8 |
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 90a81d68b5200..42c05e42b0b86 100644 --- a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh @@ -8,7 +8,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}")" |