diff --git a/packages/llama-cpp/default.nix b/packages/llama-cpp/default.nix index 857aafc..36b2910 100644 --- a/packages/llama-cpp/default.nix +++ b/packages/llama-cpp/default.nix @@ -1,12 +1,12 @@ { pkgs }: let - version = "9159"; + version = "9180"; src = pkgs.fetchFromGitHub { owner = "ggml-org"; repo = "llama.cpp"; tag = "b${version}"; - hash = "sha256-y69ZmVFxo7bQvLTT6/GWwkb5j4Ll8eXSVXFpfXVkvyg="; + hash = "sha256-DyJE7h7g9RjybSep4k66gvhYI2I2lHGaTJv1gPK4I6c="; leaveDotGit = true; postFetch = '' 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 # 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 - # sandbox. We build the WebUI from source in a separate derivation and drop - # the 4 output files into tools/server/public/ so cmake's "Priority 1: local + # sandbox. We build the UI from source in a separate derivation and drop the + # 4 output files into build/tools/ui/dist/ so cmake's "Priority 1: local # 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 { name = "llama-webui-${version}-npm-deps"; inherit src; - sourceRoot = "${src.name}/tools/server/webui"; + sourceRoot = "${src.name}/tools/ui"; hash = "sha256-WaEePrEZ7O/7deP2KJhe0AwiSKYA8HOqETmMHUkmBe0="; }; @@ -41,31 +34,31 @@ let pname = "llama-webui"; inherit version src; - # Custom unpack: the vite plugin writes to ../public, so both webui/ and - # public/ must be writable siblings under tools/server/. Plain sourceRoot + # Custom unpack: the vite plugin writes to ../../build/tools/ui/dist, so + # the whole tree from the repo root must be writable. Plain sourceRoot # leaves the parent dirs in the read-only Nix store. unpackPhase = '' runHook preUnpack - cp -r ${src}/tools/server tools-server - chmod -R u+w tools-server - cd tools-server/webui + cp -r ${src} llama-src + chmod -R u+w llama-src + cd llama-src/tools/ui runHook postUnpack ''; npmDeps = webuiNpmDeps; - # The vite plugin writes to ../public; ensure it exists. + # The vite plugin writes to ../../build/tools/ui/dist; ensure it exists. preBuild = '' - mkdir -p ../public + mkdir -p ../../build/tools/ui/dist ''; installPhase = '' runHook preInstall mkdir -p $out - install -Dm644 ../public/index.html $out/index.html - install -Dm644 ../public/bundle.js $out/bundle.js - install -Dm644 ../public/bundle.css $out/bundle.css - install -Dm644 ../public/loading.html $out/loading.html + install -Dm644 ../../build/tools/ui/dist/index.html $out/index.html + install -Dm644 ../../build/tools/ui/dist/bundle.js $out/bundle.js + install -Dm644 ../../build/tools/ui/dist/bundle.css $out/bundle.css + install -Dm644 ../../build/tools/ui/dist/loading.html $out/loading.html runHook postInstall ''; }; @@ -97,16 +90,12 @@ in ${oldAttrs.preConfigure or ""} ''; - # Apply Patches - patchFlags = [ "-p1" ]; - patches = (oldAttrs.patches or [ ]) ++ [ mtpPatch ]; - - # Drop pre-built WebUI assets into tools/server/public/ so cmake's + # Drop pre-built UI assets into build/tools/ui/dist/ so cmake's # Priority 1 path picks them up and skips the HF Bucket fetch. postPatch = '' ${oldAttrs.postPatch or ""} - mkdir -p tools/server/public - cp ${webui}/* tools/server/public/ + mkdir -p build/tools/ui/dist + cp ${webui}/* build/tools/ui/dist/ ''; # Expose the WebUI sub-derivation so it can be built/tested in isolation: