From 0eb5526b69c0bad0a3795308cd7d4ba7c93284ae Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 11 Sep 2024 07:39:52 +0000 Subject: [PATCH] ollama: don't build llama.cpp twice buildGoModules runs preBuild hooks in the module download fixed-output derivation, so llama.cpp got built and immediately discarded, to then immediately be built again for the actual Go build. --- pkgs/by-name/ol/ollama/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/ol/ollama/package.nix b/pkgs/by-name/ol/ollama/package.nix index cb00def2cbfd..c8bc1cf0d2f9 100644 --- a/pkgs/by-name/ol/ollama/package.nix +++ b/pkgs/by-name/ol/ollama/package.nix @@ -181,6 +181,14 @@ goBuild ( # replace inaccurate version number with actual release version substituteInPlace version/version.go --replace-fail 0.0.0 '${version}' ''; + + overrideModAttrs = ( + finalAttrs: prevAttrs: { + # don't run llama.cpp build in the module fetch phase + preBuild = ""; + } + ); + preBuild = '' # disable uses of `git`, since nix removes the git directory export OLLAMA_SKIP_PATCHING=true