mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
ollama: fix darwin build for 0.30.5
Two darwin-only issues surfaced when building on x86_64-darwin: 1. The conditional postPatch removed three test files (ml/backend/ggml/ggml_test.go, ml/nn/pooling/pooling_test.go, model/models/nemotronh/model_omni_test.go) that no longer exist in v0.30.5 upstream. The `rm` failed with "No such file or directory" and aborted patchPhase. Tests in the new paths (e.g. fs/ggml/ggml_test.go) pass on darwin without removal — verified via the test phase in this commit's local build. 2. preFixup ran `patchelf --shrink-rpath` unconditionally; patchelf is ELF-only and darwin's Mach-O dylibs don't carry the build-dir RPATH problem in the first place. Gated on stdenv.hostPlatform.isLinux. Verified: nix-build -A ollama on x86_64-darwin (macOS 15.6.1, Sequoia) lands /nix/store/.../ollama-0.30.5; checkPhase green for all listed packages including x/models/gemma4; ollama --version reports 0.30.5. Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0e1071782c
commit
bba51cb247
1 changed files with 3 additions and 7 deletions
|
|
@ -230,12 +230,6 @@ goBuild (finalAttrs: {
|
|||
( cd $TMPDIR/llama-cpp-src && \
|
||||
cmake -DPATCH_DIR=$NIX_BUILD_TOP/source/llama/compat \
|
||||
-P $NIX_BUILD_TOP/source/llama/compat/apply-patch.cmake )
|
||||
''
|
||||
# disable tests that fail in sandbox due to Metal init failure
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
rm ml/backend/ggml/ggml_test.go
|
||||
rm ml/nn/pooling/pooling_test.go
|
||||
rm model/models/nemotronh/model_omni_test.go
|
||||
'';
|
||||
|
||||
overrideModAttrs = _: _: {
|
||||
|
|
@ -319,7 +313,9 @@ goBuild (finalAttrs: {
|
|||
# `.so` payloads end up with build-dir entries in RPATH. Drop them
|
||||
# before the forbidden-references check. $ORIGIN is preserved
|
||||
# unconditionally; only absolute /nix/store entries are kept.
|
||||
preFixup = ''
|
||||
# ELF-only (patchelf doesn't know Mach-O); darwin builds Mach-O dylibs
|
||||
# that don't carry the build-dir RPATH problem in the first place.
|
||||
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
find $out/lib/ollama -type f \( -name '*.so' -o -name '*.so.*' \) \
|
||||
-exec patchelf --shrink-rpath --allowed-rpath-prefixes /nix/store {} +
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue