From ea47b3e43ef933148e77fa5c5fced04c6e9c1da8 Mon Sep 17 00:00:00 2001 From: Hsiang-Cheng Yang Date: Mon, 6 Mar 2023 02:15:19 +0800 Subject: [PATCH] rust-overlay: support for `darwin` --- rust-overlay.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rust-overlay.nix b/rust-overlay.nix index 3d043e0..3f275f6 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -282,6 +282,7 @@ let namesAndSrcs = getComponents pkgs.pkg name targets extensions targetExtensions stdenv fetchurl; components = installComponents stdenv namesAndSrcs; componentsOuts = builtins.map (comp: (super.lib.strings.escapeNixString (super.lib.getOutput "out" comp))) components; + sharedLibraryExtensions = stdenv.hostPlatform.extensions.sharedLibrary; in super.pkgs.symlinkJoin { name = name + "-" + version; @@ -305,9 +306,9 @@ let # Here we copy the librustc_driver-*.so to our derivation. # The SYSROOT is determined based on the path of this library. - if test "" != $out/lib/librustc_driver-*.so &> /dev/null; then - RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so) - rm $out/lib/librustc_driver-*.so + if test "" != $out/lib/librustc_driver-*${sharedLibraryExtensions} &> /dev/null; then + RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*${sharedLibraryExtensions}) + rm $out/lib/librustc_driver-*${sharedLibraryExtensions} cp $RUSTC_DRIVER_PATH $out/lib/ fi '';