diff --git a/rust-overlay.nix b/rust-overlay.nix index 46543b7..0354451 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -290,20 +290,20 @@ let for target in $out/bin/{rustc,rustdoc} $out/lib/rustlib/etc/*.py; do if [ -e $target ]; then cp --remove-destination "$(realpath -e $target)" $target - fi - # The SYSROOT is determined by using the librustc_driver-*.so. - # So, we need to point to the *.so files in our derivation. - chmod u+w $target - patchelf --set-rpath "$out/lib" $target || true + # The SYSROOT is determined by using the librustc_driver-*.so. + # So, we need to point to the *.so files in our derivation. + chmod u+w $target + patchelf --set-rpath "$out/lib" $target || true + fi done # Here we copy the librustc_driver-*.so to our derivation. # The SYSROOT is determined based on the path of this library. - if ls $out/lib/librustc_driver-*.so &> /dev/null; then - RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so) - rm $out/lib/librustc_driver-*.so - cp $RUSTC_DRIVER_PATH $out/lib/ + if ls "$out/lib/librustc_driver-*.so" &> /dev/null; then + RUSTC_DRIVER_PATH="$(realpath -e "$out/lib/librustc_driver-*.so")" + rm "$out/lib/librustc_driver-*.so" + cp "$RUSTC_DRIVER_PATH" $out/lib/ fi '';