Skip to content

Commit

Permalink
fix(darwin): do not use zig for darwin2darwin
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Nov 8, 2024
1 parent b40b491 commit ed24578
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/rust/mkAttrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,21 @@ with self.lib.rust.targets;
# Removing vendor references here invalidates the signature, which is required on aarch64-darwin
doNotRemoveReferencesToVendorDir = true;
}
# Use `rust-lld` linker and Zig C compiler for Darwin targets
// optionalAttrs pkgsCross.stdenv.hostPlatform.isDarwin {
preBuild = ''
export SDKROOT="${macos-sdk}"
'';

# Use `rust-lld` linker for Darwin targets
"CARGO_TARGET_${toUpper (kebab2snake target)}_LINKER" = "rust-lld";
}
// (
if pkgsCross.stdenv.hostPlatform.isDarwin
if final.stdenv.buildPlatform.isDarwin && pkgsCross.stdenv.hostPlatform.isDarwin
then {
# use defaults for Darwin-to-Darwin builds
}
# Use Zig C compiler and `rust-lld` linker for Darwin targets on non-Darwin platforms
else if pkgsCross.stdenv.hostPlatform.isDarwin
then {
depsBuildBuild = [
crossZigCC
Expand Down

0 comments on commit ed24578

Please sign in to comment.