Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-overlay: support for darwin #306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rust-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ let
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.
# The SYSROOT is determined by using the librustc_driver-*.{so,dylib}.
# So, we need to point to the *.{so,dylib} files in our derivation.
Copy link
Contributor

@Artturin Artturin Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps use stdenv.hostPlatform.extensions.sharedLibrary

nix-repl> stdenv.hostPlatform.extensions.sharedLibrary
".so"

example like here https://github.com/NixOS/nixpkgs/blob/b74a338b70c53011149d3c0e198b61fe43344d07/pkgs/shells/powershell/default.nix#L40

chmod u+w $target
patchelf --set-rpath "$out/lib" $target || true
done

# Here we copy the librustc_driver-*.so 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)
rm $out/lib/librustc_driver-*.so
if ls $out/lib/librustc_driver-*.{so,dylib} &> /dev/null; then
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.{so,dylib})
rm $out/lib/librustc_driver-*.{so,dylib}
cp $RUSTC_DRIVER_PATH $out/lib/
fi
'';
Expand Down