From 1dd53e35af4dcd1503bdb74116b2196f86d99d77 Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Mon, 21 Oct 2024 18:46:42 +0200 Subject: [PATCH] fix(darwin): do not use zig for darwin2darwin Signed-off-by: Roman Volosatovs --- lib/rust/mkAttrs.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/rust/mkAttrs.nix b/lib/rust/mkAttrs.nix index 507078dd..0a34cd22 100644 --- a/lib/rust/mkAttrs.nix +++ b/lib/rust/mkAttrs.nix @@ -334,9 +334,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