Skip to content

Commit

Permalink
ollama: 0.5.1 -> 0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage and mastoca committed Jan 4, 2025
1 parent 2ca9a79 commit 6084a82
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 35 deletions.
45 changes: 23 additions & 22 deletions pkgs/by-name/ol/ollama/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ assert builtins.elem acceleration [
let
pname = "ollama";
# don't forget to invalidate all hashes each update
version = "0.5.1";
version = "0.5.4";

src = fetchFromGitHub {
owner = "ollama";
repo = "ollama";
rev = "v${version}";
hash = "sha256-llsK/rMK1jf2uneqgon9gqtZcbC9PuCDxoYfC7Ta6PY=";
tag = "v${version}";
hash = "sha256-JyP7A1+u9Vs6ynOKDwun1qLBsjN+CVHIv39Hh2TYa2U=";
fetchSubmodules = true;
};

Expand Down Expand Up @@ -169,14 +169,10 @@ goBuild {
++ lib.optionals enableCuda cudaLibs
++ lib.optionals stdenv.hostPlatform.isDarwin metalFrameworks;

patches = [
# ollama's build script is unable to find hipcc
./rocm.patch
];

# replace inaccurate version number with actual release version
postPatch = ''
# replace inaccurate version number with actual release version
substituteInPlace version/version.go --replace-fail 0.0.0 '${version}'
substituteInPlace version/version.go \
--replace-fail 0.0.0 '${version}'
'';

overrideModAttrs = (
Expand All @@ -186,25 +182,28 @@ goBuild {
}
);

preBuild = ''
preBuild =
let
dist_cmd =
if cudaRequested then
"dist_cuda"
else if rocmRequested then
"dist_rocm"
else
"dist";
in
# build llama.cpp libraries for ollama
make -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/
'';
''
make ${dist_cmd} -j $NIX_BUILD_CORES
'';

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"
''
# expose runtime libraries necessary to use the gpu
+ lib.optionalString (enableRocm || enableCuda) ''
# expose runtime libraries necessary to use the gpu
wrapProgram "$out/bin/ollama" ${wrapperArgs}
'';

Expand All @@ -215,6 +214,8 @@ goBuild {
"-X=github.com/ollama/ollama/server.mode=release"
];

__darwinAllowLocalNetworking = true;

passthru = {
tests =
{
Expand Down
13 changes: 0 additions & 13 deletions pkgs/by-name/ol/ollama/rocm.patch

This file was deleted.

0 comments on commit 6084a82

Please sign in to comment.