From eb8c425e18863a464425050a2ddc0a4f1f44842c Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 16 Oct 2025 12:15:04 -0700 Subject: [PATCH 1/3] sentry-cli: partial fix --- .../se/sentry-cli/fix-swift-lib-path.patch | 13 +++++++++++++ pkgs/by-name/se/sentry-cli/package.nix | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch diff --git a/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch b/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch new file mode 100644 index 000000000000..9d3b0dedd16d --- /dev/null +++ b/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch @@ -0,0 +1,13 @@ +diff --git a/apple-catalog-parsing/build.rs b/apple-catalog-parsing/build.rs +index 2ab4c71b..80301b1a 100644 +--- a/apple-catalog-parsing/build.rs ++++ b/apple-catalog-parsing/build.rs +@@ -30,7 +30,7 @@ fn main() { + // Add necessary libraries to the linker search path. Without this line, compiling fails + // on systems without Xcode installed (xcode-select is still required). + println!( +- "cargo:rustc-link-search=native=/Library/Developer/CommandLineTools/usr/lib/swift/macosx" ++ "cargo:rustc-link-search=native=/usr/lib/swift/macosx" + ); + + let out_dir = env::var("OUT_DIR").expect("OUT_DIR is set for build scripts"); diff --git a/pkgs/by-name/se/sentry-cli/package.nix b/pkgs/by-name/se/sentry-cli/package.nix index 4011acc62608..16b0547b0ca1 100644 --- a/pkgs/by-name/se/sentry-cli/package.nix +++ b/pkgs/by-name/se/sentry-cli/package.nix @@ -6,6 +6,9 @@ openssl, pkg-config, stdenv, + swift, + swiftpm, + writeShellScriptBin, }: rustPlatform.buildRustPackage rec { pname = "sentry-cli"; @@ -22,11 +25,24 @@ rustPlatform.buildRustPackage rec { # Needed to get openssl-sys to use pkgconfig. OPENSSL_NO_VENDOR = 1; + patches = [ + ./fix-swift-lib-path.patch + ]; + buildInputs = [ openssl ]; nativeBuildInputs = [ installShellFiles pkg-config - ]; + ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ + swift + swiftpm + (writeShellScriptBin "xcode-select" '' + echo $DEVELOPER_DIR + '') + ]); + + # By default including `swiftpm` in `nativeBuildInputs` will take over `buildPhase` + dontUseSwiftpmBuild = true; cargoHash = "sha256-6AM1oGX4q6kHePiS0fsoXPt0b89O9WItIBukPIwapJQ="; From 8831c62bfdde1f1a91b810bd2b9600e37108a7df Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 16 Oct 2025 23:17:20 -0500 Subject: [PATCH 2/3] sentry-cli: fix linking issues Co-authored-by: Randy Eckenrode --- .../se/sentry-cli/fix-swift-lib-path.patch | 31 +++++++++++++++++-- pkgs/by-name/se/sentry-cli/package.nix | 9 +++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch b/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch index 9d3b0dedd16d..04274f374a8f 100644 --- a/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch +++ b/pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch @@ -1,8 +1,8 @@ diff --git a/apple-catalog-parsing/build.rs b/apple-catalog-parsing/build.rs -index 2ab4c71b..80301b1a 100644 +index 2ab4c71b59..6bcf003c0a 100644 --- a/apple-catalog-parsing/build.rs +++ b/apple-catalog-parsing/build.rs -@@ -30,7 +30,7 @@ fn main() { +@@ -30,7 +30,7 @@ // Add necessary libraries to the linker search path. Without this line, compiling fails // on systems without Xcode installed (xcode-select is still required). println!( @@ -11,3 +11,30 @@ index 2ab4c71b..80301b1a 100644 ); let out_dir = env::var("OUT_DIR").expect("OUT_DIR is set for build scripts"); +@@ -87,17 +87,14 @@ + println!("cargo:rustc-link-search=framework=/System/Library/PrivateFrameworks"); + println!("cargo:rustc-link-lib=framework=CoreUI"); + +- // Link to swift macOS support libraries for Swift runtime support on older macOS versions +- let developer_dir = Command::new("xcode-select") +- .args(["-p"]) +- .output() +- .expect("Failed to get developer directory, please ensure Xcode is installed."); +- let developer_dir_path = String::from_utf8(developer_dir.stdout) +- .expect("Failed to convert developer directory to UTF-8") +- .trim() +- .to_owned(); +- +- println!( +- "cargo:rustc-link-search={developer_dir_path}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx" ++ // Link libobjc to avoid the following error: ld: can't find ordinal for imported symbol '___objc_personality_v0' ++ println!("cargo:rustc-link-lib=objc"); ++ ++ println!( ++ "cargo:rustc-link-search=/usr/lib/swift" ++ ); ++ ++ println!( ++ "cargo:rustc-link-search=@swiftLib@/lib/swift/macosx" + ); + } \ No newline at end of file diff --git a/pkgs/by-name/se/sentry-cli/package.nix b/pkgs/by-name/se/sentry-cli/package.nix index 16b0547b0ca1..084115cfe1a4 100644 --- a/pkgs/by-name/se/sentry-cli/package.nix +++ b/pkgs/by-name/se/sentry-cli/package.nix @@ -8,7 +8,7 @@ stdenv, swift, swiftpm, - writeShellScriptBin, + replaceVars, }: rustPlatform.buildRustPackage rec { pname = "sentry-cli"; @@ -26,7 +26,9 @@ rustPlatform.buildRustPackage rec { OPENSSL_NO_VENDOR = 1; patches = [ - ./fix-swift-lib-path.patch + (replaceVars ./fix-swift-lib-path.patch { + swiftLib = lib.getLib swift; + }) ]; buildInputs = [ openssl ]; @@ -36,9 +38,6 @@ rustPlatform.buildRustPackage rec { ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ swift swiftpm - (writeShellScriptBin "xcode-select" '' - echo $DEVELOPER_DIR - '') ]); # By default including `swiftpm` in `nativeBuildInputs` will take over `buildPhase` From 0ff315567c2703895e28b3a8c2a5bb931cc9b2f5 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 16 Oct 2025 23:36:45 -0500 Subject: [PATCH 3/3] sentry-cli: fix formatting --- pkgs/by-name/se/sentry-cli/package.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/se/sentry-cli/package.nix b/pkgs/by-name/se/sentry-cli/package.nix index 084115cfe1a4..e6e44db0eca4 100644 --- a/pkgs/by-name/se/sentry-cli/package.nix +++ b/pkgs/by-name/se/sentry-cli/package.nix @@ -35,9 +35,10 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles pkg-config - ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ - swift - swiftpm + ] + ++ (lib.optionals stdenv.hostPlatform.isDarwin [ + swift + swiftpm ]); # By default including `swiftpm` in `nativeBuildInputs` will take over `buildPhase`