From 25bd3f09719570e02c33f834a4e71f7a102b9d01 Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 22 Nov 2024 20:17:46 +0400 Subject: [PATCH] bun: fix missing symbol crash on macOS 12 Adds `darwin.ICU` to the library path. Fixes the following error: > dyld[69576]: Symbol not found: _ubrk_clone > Referenced from: /nix/store/zz94xy01809rlwp70hakg5ws10acma3v-bun-1.1.36/bin/bun > Expected in: /usr/lib/libicucore.A.dylib --- pkgs/by-name/bu/bun/package.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/bu/bun/package.nix b/pkgs/by-name/bu/bun/package.nix index 8975db4fabbc..e3bb543c8d3d 100644 --- a/pkgs/by-name/bu/bun/package.nix +++ b/pkgs/by-name/bu/bun/package.nix @@ -4,11 +4,13 @@ , autoPatchelfHook , unzip , installShellFiles +, makeWrapper , openssl , writeShellScript , curl , jq , common-updater-scripts +, darwin }: stdenvNoCC.mkDerivation rec { @@ -18,7 +20,7 @@ stdenvNoCC.mkDerivation rec { src = passthru.sources.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"); strictDeps = true; - nativeBuildInputs = [ unzip installShellFiles ] ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ]; + nativeBuildInputs = [ unzip installShellFiles makeWrapper ] ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ]; buildInputs = [ openssl ]; dontConfigure = true; @@ -33,14 +35,17 @@ stdenvNoCC.mkDerivation rec { runHook postInstall ''; - - # We currently cannot generate completions for x86_64-darwin because bun requires avx support to run, which is: - # 1. Not currently supported by the version of Rosetta on our aarch64 builders - # 2. Is not correctly detected even on macOS 15+, where it is available through Rosetta - # - # The baseline builds are no longer an option because they too now require avx support. postInstall = - lib.optionalString + lib.optionalString stdenvNoCC.hostPlatform.isDarwin '' + wrapProgram $out/bin/bun \ + --prefix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath [ darwin.ICU ]} + '' + # We currently cannot generate completions for x86_64-darwin because bun requires avx support to run, which is: + # 1. Not currently supported by the version of Rosetta on our aarch64 builders + # 2. Is not correctly detected even on macOS 15+, where it is available through Rosetta + # + # The baseline builds are no longer an option because they too now require avx support. + + lib.optionalString ( stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform && !(stdenvNoCC.hostPlatform.isDarwin && stdenvNoCC.hostPlatform.isx86_64)