build(reichard.llama-cpp): bump to b9180

Update version from b9159 to b9180. Adapt to upstream renames
(tools/server/webui -> tools/ui) and updated vite output paths.
Drop MTP patch (PR #22673) which has been merged upstream.
This commit is contained in:
2026-05-16 13:58:15 -04:00
parent 3b4f54b2b1
commit 89e2161ff4

View File

@@ -1,12 +1,12 @@
{ pkgs }: { pkgs }:
let let
version = "9159"; version = "9180";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "ggml-org"; owner = "ggml-org";
repo = "llama.cpp"; repo = "llama.cpp";
tag = "b${version}"; tag = "b${version}";
hash = "sha256-y69ZmVFxo7bQvLTT6/GWwkb5j4Ll8eXSVXFpfXVkvyg="; hash = "sha256-DyJE7h7g9RjybSep4k66gvhYI2I2lHGaTJv1gPK4I6c=";
leaveDotGit = true; leaveDotGit = true;
postFetch = '' postFetch = ''
git -C "$out" rev-parse --short HEAD > $out/COMMIT git -C "$out" rev-parse --short HEAD > $out/COMMIT
@@ -14,26 +14,19 @@ let
''; '';
}; };
# MTP Patch (PR #22673)
# Use the .diff (squashed) endpoint, not .patch (mbox of commits).
mtpPatch = pkgs.fetchpatch {
name = "mtp.patch";
url = "https://github.com/ggml-org/llama.cpp/pull/22673.diff";
hash = "sha256-8W02V7oqq2/SzSrDUHEa5Zm+dGBFkasOiVinww3V85U=";
};
# Pre-Built WebUI Assets # Pre-Built WebUI Assets
# As of b9151 llama.cpp removed the prebuilt WebUI from the repo and tries to # As of b9151 llama.cpp removed the prebuilt WebUI from the repo and tries to
# curl them from a HuggingFace bucket at build time. That fails in the Nix # curl them from a HuggingFace bucket at build time. That fails in the Nix
# sandbox. We build the WebUI from source in a separate derivation and drop # sandbox. We build the UI from source in a separate derivation and drop the
# the 4 output files into tools/server/public/ so cmake's "Priority 1: local # 4 output files into build/tools/ui/dist/ so cmake's "Priority 1: local
# assets present" branch short-circuits the network fetch. # assets present" branch short-circuits the network fetch.
# Vendored npm deps. The npmDeps FOD uses default unpack and looks for #
# package-lock.json at sourceRoot, so point it directly at the webui dir. # As of b9180 the source dir was renamed tools/server/webui -> tools/ui, and
# the vite plugin now writes to ../../build/tools/ui/dist relative to tools/ui.
webuiNpmDeps = pkgs.fetchNpmDeps { webuiNpmDeps = pkgs.fetchNpmDeps {
name = "llama-webui-${version}-npm-deps"; name = "llama-webui-${version}-npm-deps";
inherit src; inherit src;
sourceRoot = "${src.name}/tools/server/webui"; sourceRoot = "${src.name}/tools/ui";
hash = "sha256-WaEePrEZ7O/7deP2KJhe0AwiSKYA8HOqETmMHUkmBe0="; hash = "sha256-WaEePrEZ7O/7deP2KJhe0AwiSKYA8HOqETmMHUkmBe0=";
}; };
@@ -41,31 +34,31 @@ let
pname = "llama-webui"; pname = "llama-webui";
inherit version src; inherit version src;
# Custom unpack: the vite plugin writes to ../public, so both webui/ and # Custom unpack: the vite plugin writes to ../../build/tools/ui/dist, so
# public/ must be writable siblings under tools/server/. Plain sourceRoot # the whole tree from the repo root must be writable. Plain sourceRoot
# leaves the parent dirs in the read-only Nix store. # leaves the parent dirs in the read-only Nix store.
unpackPhase = '' unpackPhase = ''
runHook preUnpack runHook preUnpack
cp -r ${src}/tools/server tools-server cp -r ${src} llama-src
chmod -R u+w tools-server chmod -R u+w llama-src
cd tools-server/webui cd llama-src/tools/ui
runHook postUnpack runHook postUnpack
''; '';
npmDeps = webuiNpmDeps; npmDeps = webuiNpmDeps;
# The vite plugin writes to ../public; ensure it exists. # The vite plugin writes to ../../build/tools/ui/dist; ensure it exists.
preBuild = '' preBuild = ''
mkdir -p ../public mkdir -p ../../build/tools/ui/dist
''; '';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out mkdir -p $out
install -Dm644 ../public/index.html $out/index.html install -Dm644 ../../build/tools/ui/dist/index.html $out/index.html
install -Dm644 ../public/bundle.js $out/bundle.js install -Dm644 ../../build/tools/ui/dist/bundle.js $out/bundle.js
install -Dm644 ../public/bundle.css $out/bundle.css install -Dm644 ../../build/tools/ui/dist/bundle.css $out/bundle.css
install -Dm644 ../public/loading.html $out/loading.html install -Dm644 ../../build/tools/ui/dist/loading.html $out/loading.html
runHook postInstall runHook postInstall
''; '';
}; };
@@ -97,16 +90,12 @@ in
${oldAttrs.preConfigure or ""} ${oldAttrs.preConfigure or ""}
''; '';
# Apply Patches # Drop pre-built UI assets into build/tools/ui/dist/ so cmake's
patchFlags = [ "-p1" ];
patches = (oldAttrs.patches or [ ]) ++ [ mtpPatch ];
# Drop pre-built WebUI assets into tools/server/public/ so cmake's
# Priority 1 path picks them up and skips the HF Bucket fetch. # Priority 1 path picks them up and skips the HF Bucket fetch.
postPatch = '' postPatch = ''
${oldAttrs.postPatch or ""} ${oldAttrs.postPatch or ""}
mkdir -p tools/server/public mkdir -p build/tools/ui/dist
cp ${webui}/* tools/server/public/ cp ${webui}/* build/tools/ui/dist/
''; '';
# Expose the WebUI sub-derivation so it can be built/tested in isolation: # Expose the WebUI sub-derivation so it can be built/tested in isolation: