mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
ollama: 0.5.1 -> 0.5.4 (#365718)
This commit is contained in:
commit
f23ec9f976
2 changed files with 31 additions and 35 deletions
|
@ -19,7 +19,9 @@
|
||||||
cudaPackages,
|
cudaPackages,
|
||||||
darwin,
|
darwin,
|
||||||
autoAddDriverRunpath,
|
autoAddDriverRunpath,
|
||||||
|
versionCheckHook,
|
||||||
|
|
||||||
|
# passthru
|
||||||
nixosTests,
|
nixosTests,
|
||||||
testers,
|
testers,
|
||||||
ollama,
|
ollama,
|
||||||
|
@ -41,13 +43,13 @@ assert builtins.elem acceleration [
|
||||||
let
|
let
|
||||||
pname = "ollama";
|
pname = "ollama";
|
||||||
# don't forget to invalidate all hashes each update
|
# don't forget to invalidate all hashes each update
|
||||||
version = "0.5.1";
|
version = "0.5.4";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ollama";
|
owner = "ollama";
|
||||||
repo = "ollama";
|
repo = "ollama";
|
||||||
rev = "v${version}";
|
tag = "v${version}";
|
||||||
hash = "sha256-llsK/rMK1jf2uneqgon9gqtZcbC9PuCDxoYfC7Ta6PY=";
|
hash = "sha256-JyP7A1+u9Vs6ynOKDwun1qLBsjN+CVHIv39Hh2TYa2U=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,14 +171,10 @@ goBuild {
|
||||||
++ lib.optionals enableCuda cudaLibs
|
++ lib.optionals enableCuda cudaLibs
|
||||||
++ lib.optionals stdenv.hostPlatform.isDarwin metalFrameworks;
|
++ lib.optionals stdenv.hostPlatform.isDarwin metalFrameworks;
|
||||||
|
|
||||||
patches = [
|
# replace inaccurate version number with actual release version
|
||||||
# ollama's build script is unable to find hipcc
|
|
||||||
./rocm.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
# replace inaccurate version number with actual release version
|
substituteInPlace version/version.go \
|
||||||
substituteInPlace version/version.go --replace-fail 0.0.0 '${version}'
|
--replace-fail 0.0.0 '${version}'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
overrideModAttrs = (
|
overrideModAttrs = (
|
||||||
|
@ -186,25 +184,28 @@ goBuild {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
preBuild = ''
|
preBuild =
|
||||||
|
let
|
||||||
|
dist_cmd =
|
||||||
|
if cudaRequested then
|
||||||
|
"dist_cuda_v${cudaMajorVersion}"
|
||||||
|
else if rocmRequested then
|
||||||
|
"dist_rocm"
|
||||||
|
else
|
||||||
|
"dist";
|
||||||
|
in
|
||||||
# build llama.cpp libraries for ollama
|
# build llama.cpp libraries for ollama
|
||||||
make -j $NIX_BUILD_CORES
|
''
|
||||||
'';
|
make ${dist_cmd} -j $NIX_BUILD_CORES
|
||||||
|
'';
|
||||||
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
||||||
# copy libggml_*.so and runners into lib
|
|
||||||
# https://github.com/ollama/ollama/blob/v0.4.4/llama/make/gpu.make#L90
|
|
||||||
mkdir -p $out/lib
|
|
||||||
cp -r dist/*/lib/* $out/lib/
|
|
||||||
'';
|
|
||||||
|
|
||||||
postFixup =
|
postFixup =
|
||||||
|
# the app doesn't appear functional at the moment, so hide it
|
||||||
''
|
''
|
||||||
# the app doesn't appear functional at the moment, so hide it
|
|
||||||
mv "$out/bin/app" "$out/bin/.ollama-app"
|
mv "$out/bin/app" "$out/bin/.ollama-app"
|
||||||
''
|
''
|
||||||
|
# expose runtime libraries necessary to use the gpu
|
||||||
+ lib.optionalString (enableRocm || enableCuda) ''
|
+ lib.optionalString (enableRocm || enableCuda) ''
|
||||||
# expose runtime libraries necessary to use the gpu
|
|
||||||
wrapProgram "$out/bin/ollama" ${wrapperArgs}
|
wrapProgram "$out/bin/ollama" ${wrapperArgs}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -215,6 +216,14 @@ goBuild {
|
||||||
"-X=github.com/ollama/ollama/server.mode=release"
|
"-X=github.com/ollama/ollama/server.mode=release"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
__darwinAllowLocalNetworking = true;
|
||||||
|
|
||||||
|
nativeInstallCheck = [
|
||||||
|
versionCheckHook
|
||||||
|
];
|
||||||
|
versionCheckProgramArg = [ "--version" ];
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests =
|
tests =
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/llama/make/Makefile.rocm b/llama/make/Makefile.rocm
|
|
||||||
index 4ab176b4..cd8be223 100644
|
|
||||||
--- a/llama/make/Makefile.rocm
|
|
||||||
+++ b/llama/make/Makefile.rocm
|
|
||||||
@@ -15,7 +15,7 @@ ifeq ($(OS),windows)
|
|
||||||
GPU_COMPILER:=$(GPU_COMPILER_WIN)
|
|
||||||
else ifeq ($(OS),linux)
|
|
||||||
GPU_LIB_DIR_LINUX := $(HIP_PATH)/lib
|
|
||||||
- GPU_COMPILER_LINUX := $(shell X=$$(which hipcc 2>/dev/null) && echo $$X)
|
|
||||||
+ GPU_COMPILER_LINUX := $(HIP_PATH)/bin/hipcc
|
|
||||||
GPU_COMPILER:=$(GPU_COMPILER_LINUX)
|
|
||||||
ROCM_TRANSITIVE_LIBS_INITIAL = $(sort $(shell ldd $(GPU_LIBS) | grep "=>" | cut -f2 -d= | cut -f2 -d' ' | grep -e rocm -e amdgpu -e libtinfo -e libnuma -e libelf))
|
|
||||||
GPU_TRANSITIVE_LIBS = $(sort $(shell readlink -f $(ROCM_TRANSITIVE_LIBS_INITIAL)) $(ROCM_TRANSITIVE_LIBS_INITIAL))
|
|
Loading…
Add table
Add a link
Reference in a new issue