From 33cdcdd4154a82afbabaf3c0da031283484efca5 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Wed, 26 Apr 2023 01:19:18 +0200 Subject: [PATCH] simplify learned tricks from #306 --- rust-overlay.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/rust-overlay.nix b/rust-overlay.nix index 0918f56..6cb5fd6 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -290,7 +290,7 @@ let cp --remove-destination "$(realpath -e $target)" $target fi - # The SYSROOT is determined by using the librustc_driver-*.so. + # The SYSROOT is determined by using the librustc_driver-*.{so,dylib}. # So, we need to point to the *.so files in our derivation. if ls $out/lib/*.so &>/dev/null; then chmod u+w $target @@ -298,14 +298,10 @@ let fi done - # Here we copy the librustc_driver-*.{so|dylib} to our derivation. + # Here we copy the librustc_driver-*.{so,dylib} 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) - cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/ - fi - if ls $out/lib/librustc_driver-*.dylib &>/dev/null; then - RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.dylib) + if ls $out/lib/librustc_driver-*.{so,dylib} &>/dev/null; then + RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.{so,dylib}) cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/ fi '';