ollama: add update.sh which also updates llamaCppSrc

This commit is contained in:
Pavol Rusnak
2026-07-23 18:44:48 +02:00
parent ad75f18806
commit 97087f83d5
2 changed files with 26 additions and 4 deletions
+5 -4
View File
@@ -6,7 +6,6 @@
makeBinaryWrapper,
stdenv,
addDriverRunpath,
nix-update-script,
cmake,
gitMinimal,
@@ -112,11 +111,12 @@ let
# vendored in-tree. Pre-stage the pin (tracks upstream's
# `LLAMA_CPP_VERSION` file) so the FetchContent step uses our copy
# instead of trying to clone over the network in the sandbox.
llamaCppVersion = "b9888";
llamaCppSrc = fetchFromGitHub {
owner = "ggml-org";
repo = "llama.cpp";
tag = "b9840";
hash = "sha256-SlcBqlUSeXgGltk7fz1blp4DobypzkT8cw8a7dkVGiU=";
tag = llamaCppVersion;
hash = "sha256-9G7PqT1lQ414Ecg5Fp4qrShJOfMH9iYXZgY40EyAwEw=";
};
wrapperOptions = [
@@ -366,6 +366,7 @@ goBuild (finalAttrs: {
versionCheckKeepEnvironment = "HOME";
passthru = {
inherit llamaCppSrc llamaCppVersion;
tests = {
inherit ollama;
}
@@ -377,7 +378,7 @@ goBuild (finalAttrs: {
service-vulkan = nixosTests.ollama-vulkan;
};
}
// lib.optionalAttrs (!enableRocm && !enableCuda) { updateScript = nix-update-script { }; };
// lib.optionalAttrs (!enableRocm && !enableCuda && !enableVulkan) { updateScript = ./update.sh; };
meta = {
description =
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts nix-update
# shellcheck shell=bash
set -euo pipefail
nix-update ollama --src-only
ollama_src=$(nix-build --no-out-link -A ollama.src)
llama_cpp_version=$(<"$ollama_src/LLAMA_CPP_VERSION")
if [[ -z "$llama_cpp_version" ]]; then
echo "LLAMA_CPP_VERSION is empty" >&2
exit 1
fi
update-source-version ollama "$llama_cpp_version" \
--source-key=llamaCppSrc \
--version-key=llamaCppVersion
nix-update ollama --version=skip