From 73f782d5232d1d5cf564bf784616e73273591d07 Mon Sep 17 00:00:00 2001 From: Alexander Miroshnichenko Date: Sun, 13 Sep 2026 13:33:30 +0300 Subject: [PATCH] feat(packages): add llama-cpp b9645 for Strix Halo (ROCm + Vulkan) Pin upstream llama.cpp b9645 and build it against the nixpkgs-latest input (the flake's pinned nixpkgs only carries the pre-tools/ui b8983). ROCm deps come from rocmPackages.gfx1151, so clr/rocBLAS/hipBLAS are built for gfx1151 only; clr's own build is arch-independent, so its store path stays substitutable. Vulkan on, CPU variants with znver5 / AVX-512, web UI and npm toolchain dropped. Ported from nixos-config's llm-engine.nix with two fixes: npmConfigHook hard-fails when npmDeps is null, so nodejs and the hook are stripped from nativeBuildInputs, and CMAKE_HIP_FLAGS is appended to cmakeFlagsArray because the cmake hook word-splits plain cmakeFlags. Verified on the Radeon 8060S (gfx1151): llama-bench loads both ROCm and Vulkan backends and completes pp16/tg8 runs. --- .beads/issues.jsonl | 26 ++++---- README.md | 1 + packages/llama-cpp/default.nix | 17 +++++ packages/llama-cpp/package.nix | 117 +++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+), 12 deletions(-) create mode 100644 packages/llama-cpp/default.nix create mode 100644 packages/llama-cpp/package.nix diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index cfd084b..18451a2 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1,12 +1,14 @@ -{"_type":"issue","id":"nix-overlay-dv3","title":"Fix Config screen crash on F2","description":"F2 opens ConfigScreen then Textual raises InvalidSelectValueError because _refresh_aggregator_dropdown assigns Select.BLANK, resolved as False, instead of clearing selection.\\n\\nAcceptance: Config screen opens with saved consensus configuration; regression covers no selected aggregator; targeted tests pass.","status":"closed","priority":1,"issue_type":"bug","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-20T11:34:03Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-20T11:37:47Z","started_at":"2026-08-20T11:34:07Z","closed_at":"2026-08-20T11:37:47Z","close_reason":"Replaced invalid Select.BLANK handling; built haivemind and verified ConfigScreen headlessly.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-a9m","title":"Fix haivemind startup after MainScreen mount","description":"Restore deferred engine startup while preserving MainScreen widget lookup fix.","status":"closed","priority":1,"issue_type":"bug","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-20T11:20:36Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-20T11:21:43Z","started_at":"2026-08-20T11:20:43Z","closed_at":"2026-08-20T11:21:43Z","close_reason":"Restored engine startup after MainScreen mount and verified package build.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-q2m","title":"Add FreeToken package (FlashML-org/FreeToken)","description":"Package https://github.com/FlashML-org/FreeToken into the overlay following the standard packages/\u0026lt;name\u0026gt;/{default.nix,package.nix} pattern. Must build via nix build, README updated, category set.","notes":"Build in progress. Resolved: tvm-ffi 0.1.13.post3 builds (cython 3.3.0 vendored, dontUsePytestCheck due to xdist addopts), flashlib wheel + pythonRemoveDeps, freetoken pythonRelaxDeps gguf/modelscope. Remaining: torch-bin CUDA closure (nccl done; libnvshmem source build ~hours), then freetoken extensions. Note: torch-bin 2.11 = +cu128 PyPI wheel autoPatchelf'd to nixpkgs cuda12.9 libs.","status":"closed","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-30T06:40:20Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-30T17:51:10Z","started_at":"2026-08-30T06:40:34Z","closed_at":"2026-08-30T17:51:10Z","close_reason":"freetoken 0.1.2 packaged: builds via nix build .#freetoken, ft CLI verified (ft --version), imports checked, RPATHs correct (cudart 12.9 + torch-bin libs). Docs in README + meta.longDescription.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-q00","title":"Add haivemind package","description":"Package https://github.com/dev-boz/haivemind in the Nix overlay, document it, validate the build, and complete repository workflow.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-08T16:32:37Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-08T16:36:41Z","started_at":"2026-08-08T16:33:00Z","closed_at":"2026-08-08T16:36:41Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-67e","title":"Add traycer package","description":"Add new package for traycer from https://github.com/traycerai/traycer. Steps: research repo build system, create packages/traycer/, stage with git add, test nix build, update README.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T08:59:25Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T09:22:07Z","started_at":"2026-08-07T09:00:29Z","closed_at":"2026-08-07T09:22:07Z","close_reason":"Traycer package added, built, pushed","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-2gf","title":"Update all packages to latest versions","description":"## Why\\nUser request: update every package in the overlay to its latest upstream version.\\n\\n## What\\nBump version + src hash (and cargoHash for Rust) in each packages/\u003cname\u003e/package.nix, update README table if needed, verify builds.\\n\\n## Acceptance\\n- Every package builds with nix build .#\u003cname\u003e\\n- README reflects new versions\\n- Changes committed and pushed","notes":"All packages updated and built successfully. Commit 1f3f0f468bdd on local main. PUSH BLOCKED: git.millerson.name:22002 and DoltHub unreachable from this network (SSH connect timeout). Re-run git push + bd dolt push when network is back, then close.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T07:22:50Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T13:17:34Z","started_at":"2026-08-07T07:22:55Z","closed_at":"2026-08-07T13:17:34Z","close_reason":"All packages updated to latest versions, verified building, pushed to origin","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-9xs","title":"Update all packages to latest versions","description":"Update every package in packages/ to its latest upstream version, refresh source hashes and cargoHashes, verify builds, update README.","status":"in_progress","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T05:45:16Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T05:45:22Z","started_at":"2026-08-07T05:45:22Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-f8c","title":"Add nftablesbuilder package","description":"Package NftablesBuilder (github.com/AiseBouma/NftablesBuilder) web interface to manage nftables. Upstream source is incomplete (missing settings crate, no GUI build tooling, no Cargo.lock) so: patch in authored settings crate (schema from release artifacts), build Rust workspace from pinned commit, reuse built GUI assets from hash-pinned release tarball.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T04:58:22Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T05:38:40Z","started_at":"2026-08-07T04:58:25Z","closed_at":"2026-08-07T05:38:40Z","close_reason":"Package added, builds green, committed","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-bjd","title":"Add nftables-analyzer CLI package","description":"Add python3Packages.buildPythonApplication derivation for reinaldosaraiva/nftables-analyzer (CLI only). Pin to main commit 5fc78d0c9ce173e3baa80a5655bcadb1b2f78493 (no tags upstream). sourceRoot=source/backend, hatchling build system. Category: Networking. Frontend excluded - upstream repo missing frontend/src/lib modules.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T04:48:07Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T04:50:25Z","started_at":"2026-08-07T04:48:10Z","closed_at":"2026-08-07T04:50:25Z","close_reason":"Package added, built, smoke-tested, committed","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-5gg","title":"freetoken: optional accel extras and kernel-cache wheel","description":"Follow-ups for the freetoken package: (1) package flashinfer[cu12] and sglang-kernel 0.4.5 (accel extra) so the native fast path is available instead of the Triton fallback; (2) package the freetoken-kernel-cache companion wheel (prebuilt TVM FFI kernels, built via scripts/build-release-wheels.sh) so TVM JIT kernel compilation (nvcc at runtime) can be avoided. Both blocked on suitable PyPI/CUDA packaging work in nixpkgs (flashinfer exists in nixpkgs but needs cu12 variant). Priority: backlog.","status":"open","priority":3,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-08-30T17:58:57Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-30T17:58:57Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"nix-overlay-vhq","title":"Note missing Dolt remote in AGENTS.md","description":"## Why\\nAgents running bd dolt push see 'No remote is configured - skipping' and may mistake it for a failure (blocking session close). Document that this is expected: no Dolt remote is set up, beads state is versioned locally in .beads/ and committed via git.\\n\\n## What\\nAdd a short note in the Beads Issue Tracker / Session Completion section of AGENTS.md.\\n\\n## Acceptance\\n- AGENTS.md explains the expected bd dolt push output and that git push is the actual sync mechanism","status":"closed","priority":3,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T13:18:33Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T13:19:26Z","started_at":"2026-08-07T13:18:51Z","closed_at":"2026-08-07T13:19:26Z","close_reason":"AGENTS.md updated and pushed","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"memory","key":"python-packaging-in-this-overlay-torch-bin-cuda","value":"python packaging in this overlay: torch-bin (CUDA) propagates triton-bin — always use py.torch-bin AND py.triton-bin together (python-packages.nix maps torch-bin = callPackage { triton = self.triton-bin; }) or you get duplicate triton in closure. Unfree CUDA deps: self-scope with 'import pkgs.path { config.allowUnfree = true; }' inside package.nix — no flake-level or user config changes needed. cuda_cudart include lacks crt/ headers — they live in cudaPackages.cuda_nvcc/include/crt; merge into a synthetic CUDA_HOME. pythonRuntimeDepsCheck enforces version constraints (not just names) — use pythonRelaxDeps/pythonRemoveDeps."} +{"_type":"issue","id":"nix-overlay-05o","title":"Add llama-cpp package (build 9645) to overlay","description":"Port the pinned llama.cpp b9645 derivation from nixos-config/modules/llm-engine.nix into packages/llama-cpp/ (default.nix + package.nix). ROCm + Vulkan enabled, znver5 CPU flags, strix-halo gfx1151 orientation. Must build via nix build .#llama-cpp.","status":"in_progress","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-09-13T09:22:26Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-09-13T09:22:28Z","started_at":"2026-09-13T09:22:28Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-6y6","title":"Add Loop corporate messenger package","description":"Add Loop - Corporate messenger for your team. Distributed as x86-64 binary from https://artifacts.wilix.dev/repository/loop-files/loop-6.0.3/loop-desktop-6.0.3-linux-x64.tar.gz","status":"closed","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-29T16:41:37Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-29T16:51:32Z","started_at":"2026-05-29T16:42:02Z","closed_at":"2026-05-29T16:51:32Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-cdt","title":"radar-1.6.1","description":"update package radar to v1.6.1","status":"closed","priority":2,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-05-17T12:41:54Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-17T13:03:38Z","closed_at":"2026-05-17T13:03:38Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-27z","title":"freebuff","description":"В данный nixos overlay репозиторй необходимо добавить новый пакет https://www.npmjs.com/package/freebuff .\nИспользуй mcp: nixos, karpathy-guidelines и Sequential Thinking для планирования шаг за шагом задачи. Управление тасками используй beads. Разбей задачу на подзадачи, используя beads с указанием parent task.\n\nRequired Skills\ncaveman,karpathy-guidelines,nix,nix-flakes","status":"closed","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T16:11:44Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T17:03:53Z","started_at":"2026-05-11T16:17:34Z","closed_at":"2026-05-11T17:03:53Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc.5","title":"Update package metadata and updateScript","description":"Remove binaryNativeCode sourceProvenance, update meta, adjust updateScript for source build","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T13:51:22Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T15:01:06Z","started_at":"2026-05-11T14:59:33Z","closed_at":"2026-05-11T15:01:06Z","close_reason":"Closed","dependencies":[{"issue_id":"nix-overlay-qlc.5","depends_on_id":"nix-overlay-qlc","type":"parent-child","created_at":"2026-05-11T16:51:21Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc.4","title":"Test build and verify functionality","description":"Build radar from source and verify it runs correctly","status":"closed","priority":2,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-05-11T13:51:11Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T14:59:55Z","closed_at":"2026-05-11T14:59:55Z","close_reason":"Closed","dependencies":[{"issue_id":"nix-overlay-qlc.4","depends_on_id":"nix-overlay-qlc","type":"parent-child","created_at":"2026-05-11T16:51:10Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc.3","title":"Handle go:embed frontend assets","description":"Ensure frontend assets are copied to internal/static/dist before Go build so go:embed works correctly","status":"closed","priority":2,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-05-11T13:51:02Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T14:59:55Z","closed_at":"2026-05-11T14:59:55Z","close_reason":"Closed","dependencies":[{"issue_id":"nix-overlay-qlc.3","depends_on_id":"nix-overlay-qlc","type":"parent-child","created_at":"2026-05-11T16:51:02Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc.2","title":"Configure npm dependencies for frontend build","description":"Set up npmDependencies hash for the Vite/React frontend build within buildGoModule","status":"closed","priority":2,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-05-11T13:50:53Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T14:59:55Z","closed_at":"2026-05-11T14:59:55Z","close_reason":"Closed","dependencies":[{"issue_id":"nix-overlay-qlc.2","depends_on_id":"nix-overlay-qlc","type":"parent-child","created_at":"2026-05-11T16:50:52Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc.1","title":"Update radar default.nix to use buildGoModule","description":"Change package.nix from stdenv.mkDerivation with fetchurl to buildGoModule pattern","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T13:50:42Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T14:59:55Z","started_at":"2026-05-11T13:51:49Z","closed_at":"2026-05-11T14:59:55Z","close_reason":"Closed","dependencies":[{"issue_id":"nix-overlay-qlc.1","depends_on_id":"nix-overlay-qlc","type":"parent-child","created_at":"2026-05-11T16:50:41Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-qlc","title":"Rebuild radar package from source instead of prebuilt binary","description":"Current radar package uses prebuilt binary from GitHub releases. Need to rebuild from source using nix native tooling (buildGoModule + npm for frontend). Build pipeline: 1) npm run build for frontend, 2) copy assets to internal/static/dist, 3) CGO_ENABLED=0 go build with embedded assets.","status":"closed","priority":2,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-05-11T13:50:27Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T15:01:06Z","closed_at":"2026-05-11T15:01:06Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-y8r","title":"nix-overlay-2lr-3 · Approach 3: ручной npm cache + buildGoModule [parent:nix-overlay-2lr]","notes":"BLOCKED: fetchNpmDeps v2 не загружает workspace-scoped пакеты (@vitejs/plugin-react ENOTCACHED) даже с makeCacheWritable=true. Все 3 подхода заблокированы одним ограничением — fetchNpmDeps v2 не поддерживает npm workspaces корректно, вопреки release notes.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T09:38:34Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T11:14:40Z","started_at":"2026-05-11T10:23:41Z","closed_at":"2026-05-11T11:14:40Z","dependencies":[{"issue_id":"nix-overlay-y8r","depends_on_id":"nix-overlay-2lr","type":"parent-child","created_at":"2026-05-11T12:42:18Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-dcx","title":"nix-overlay-2lr-2 · Approach 2: bun2nix генерация пакетов [parent:nix-overlay-2lr]","notes":"Skipping bun2nix — требует staging branch, неочевидная поддержка npm lockfiles. Проще перейти к Approach 3 (ручной stdenv.mkDerivation с nodejs/npm).","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T09:38:06Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T10:23:18Z","started_at":"2026-05-11T10:21:04Z","closed_at":"2026-05-11T10:23:18Z","dependencies":[{"issue_id":"nix-overlay-dcx","depends_on_id":"nix-overlay-2lr","type":"parent-child","created_at":"2026-05-11T12:42:12Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-3ik","title":"nix-overlay-2lr-1 · Approach 1: buildNpmPackage + buildGoModule с npmDepsFetcherVersion=2 [parent:nix-overlay-2lr]","notes":"fetchNpmDeps v2 не resolves workspace-scoped packages (@vitejs/plugin-react ENOTCACHED). Approach blocked — same issue as previous attempt. Moving to Approach 2 (bun2nix).","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-11T09:37:43Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T10:20:38Z","started_at":"2026-05-11T09:39:05Z","closed_at":"2026-05-11T10:20:38Z","dependencies":[{"issue_id":"nix-overlay-3ik","depends_on_id":"nix-overlay-2lr","type":"parent-child","created_at":"2026-05-11T12:41:54Z","created_by":"Alexander Miroshnichenko","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"nix-overlay-2lr","title":"radar","description":"Используй karpathy-guidelines и Sequential Thinking для планирования шаг за шагом добавления нового пакета https://github.com/skyhook-io/radar.git в данный NIXOS overlay-репозиторий. Разбей задачу на подзадачи, используя beads. В написании кода используй mcp: nixos, refContext и context7.\n\n\n\n## Required Skills\ncaveman,karpathy-guidelines,nix,nix-flakes","notes":"Все 3 подхода провалены. fetchNpmDeps v2 НЕ работает с npm workspaces вопреки release notes - ENOTCACHED для workspace-scoped пакетов (@vitejs/plugin-react). Ручной сбор node_modules без npm ci слишком сложен (требует reimplement fetchNpmDeps). Текущее решение: pre-built binary из GitHub Releases. Нужно дождаться исправления fetchNpmDeps v2 в nixpkgs или upstream поддержки standalone lockfile для web/.","status":"closed","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-05-10T19:28:56Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-05-11T11:24:40Z","started_at":"2026-05-10T19:30:31Z","closed_at":"2026-05-11T11:24:40Z","dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/README.md b/README.md index 184e1e0..e55f248 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ A custom Nix overlay and flake providing additional packages not found in upstre | `nftablesbuilder` | Web interface to manage nftables rules with drag-and-drop rule creation | Networking | | `skillsmcp` | MCP server that exposes Agent Skills to AI agents via the Model Context Protocol | MCP Servers | | `kubernetes-mcp-server` | Model Context Protocol (MCP) server for Kubernetes and OpenShift | MCP Servers | +| `llama-cpp` | llama.cpp pinned to build b9645, built for Strix Halo (gfx1151) with ROCm + Vulkan backends | AI Inference | | `loop` | Corporate messenger for your team | Communication | | `radar` | Modern Kubernetes visibility — topology, event timeline, service traffic, resource browsing, Helm management, and GitOps support | Kubernetes | | `omniroute` | Unified AI router with 160+ providers, auto fallback, MCP/A2A, OpenAI-compatible APIs | AI LLM Gateway | diff --git a/packages/llama-cpp/default.nix b/packages/llama-cpp/default.nix new file mode 100644 index 0000000..addede1 --- /dev/null +++ b/packages/llama-cpp/default.nix @@ -0,0 +1,17 @@ +{ + pkgs, + inputs, + ... +}: +# llama.cpp b9645 is newer than the flake's pinned nixpkgs (llama-cpp b8983, +# pre-tools/ui) and needs its UI/ROCm layout, so build against the +# nixpkgs-latest input — same pattern as mcp-gateway/kubernetes-mcp-server. +let + latestPkgs = inputs.nixpkgs-latest.legacyPackages.${pkgs.stdenv.hostPlatform.system}; +in +latestPkgs.callPackage ./package.nix { + # Strix Halo: build the ROCm dependencies (clr, rocBLAS, hipBLAS) for gfx1151 + # only instead of every supported arch. clr's own build is arch-independent, + # so its store path is unchanged and stays substitutable. + rocmPackages = latestPkgs.rocmPackages.gfx1151; +} diff --git a/packages/llama-cpp/package.nix b/packages/llama-cpp/package.nix new file mode 100644 index 0000000..b08a7c6 --- /dev/null +++ b/packages/llama-cpp/package.nix @@ -0,0 +1,117 @@ +{ + lib, + # Build skeleton: nixpkgs' own llama-cpp derivation (b-tag layout, cmake/npm + # plumbing), retargeted at the pinned tag below. + llama-cpp, + fetchFromGitHub, + rocmPackages, + # nixpkgs-latest's nodejs/npm hooks: referenced only to strip them from + # nativeBuildInputs (the npm/web UI build is disabled below). + nodejs_latest, + npmHooks, + # Strix Halo (Radeon 8060S). clr/rocBLAS/hipBLAS come prefixed for this arch + # by the scoped rocmPackages in ./default.nix. + rocmGpuTargets ? [ "gfx1151" ], +}: + +let + # Upstream release tag. Bump with: + # nix flake prefetch github:ggml-org/llama.cpp/b + # then update buildNumber and the src hash. + buildNumber = "9645"; + + # HIP flags from the llm-engine.nix bring-up config. The -I paths for + # hipBLASLt/rocWMMA are dropped because this tag's HIP backend links + # hipBLAS/rocBLAS only; GGML_HIPBLASLT and GGML_CUDA_ENABLE_UNIFIED_MEMORY + # are also unused by b9645 (cmake warns and ignores them). + hipFlags = lib.concatStringsSep " " [ + "-mllvm" + "-amdgpu-early-inline-all=true" + "-mllvm" + "-amdgpu-function-calls=false" + "-mprefer-vector-width=512" + "-famd-opt" + "-mllvm" + "-inline-threshold=600" + "-mllvm" + "-unroll-threshold=150" + ]; +in +(llama-cpp.override { + inherit rocmPackages rocmGpuTargets; + rocmSupport = true; + vulkanSupport = true; + cudaSupport = false; +}).overrideAttrs + (old: { + version = buildNumber; + + src = fetchFromGitHub { + owner = "ggml-org"; + repo = "llama.cpp"; + tag = "b${buildNumber}"; + # Tarball hash (this tag has no submodules). + hash = "sha256-ntRwfI2/yVqi3QjQfO0ZajMFSD8r/6XPiuy0X2BhwVk="; + }; + + # The embedded web UI is disabled via cmakeFlags, so none of the npm + # machinery is needed: no dependency tree, and npmConfigHook hard-fails + # when npmDeps is null, so it (and nodejs) must come off the inputs. + npmDeps = null; + npmRoot = null; + npmDepsHash = null; + nativeBuildInputs = builtins.filter (x: x != nodejs_latest && x != npmHooks.npmConfigHook) ( + old.nativeBuildInputs or [ ] + ); + + # The release tarball has no .git; upstream wants the build id in COMMIT. + postPatch = '' + echo ${buildNumber} > COMMIT + ''; + + # Replaces the base derivation's npm build step. CMAKE_HIP_FLAGS holds + # several space-separated flags, so it must be appended as an array element: + # plain cmakeFlags scalars are word-split by the cmake hook. + preConfigure = '' + prependToVar cmakeFlags "-DLLAMA_BUILD_COMMIT:STRING=$(cat COMMIT)" + cmakeFlagsArray+=("-DCMAKE_HIP_FLAGS=${hipFlags}") + ''; + + cmakeFlags = + builtins.filter (f: !(builtins.isString f && builtins.match ".*LLAMA_BUILD_NUMBER.*" f != null)) ( + old.cmakeFlags or [ ] + ) + ++ [ + "-DCMAKE_C_FLAGS=-march=znver5" + "-DCMAKE_CXX_FLAGS=-march=znver5" + "-DGGML_CPU=ON" + "-DGGML_AVX=ON" + "-DGGML_AVX_VNNI=ON" + "-DGGML_AVX2=ON" + "-DGGML_BMI2=ON" + "-DGGML_AVX512=ON" + "-DGGML_AVX512_VNNI=ON" + "-DGGML_AVX512_VBMI=ON" + "-DGGML_AVX512_BF16=ON" + "-DGGML_FMA=ON" + "-DGGML_F16C=ON" + "-DHIP_PLATFORM=amd" + "-DGGML_CUDA_FORCE_CUBLAS=OFF" + "-DGGML_HIPBLASLT=ON" + "-DGGML_HIP_NO_VMM=ON" + "-DGGML_HIP_GRAPHS=ON" + "-DGGML_CUDA_ENABLE_UNIFIED_MEMORY=ON" + "-DGGML_HIP_ROCWMMA_FATTN=OFF" + "-DGGML_HIP_MMQ_MFMA=ON" + "-DGGML_CUDA_FA_ALL_QUANTS=ON" + "-DCMAKE_BUILD_TYPE=Release" + "-DLLAMA_BUILD_NUMBER:STRING=${buildNumber}" + (lib.cmakeBool "LLAMA_BUILD_UI" false) + (lib.cmakeBool "LLAMA_USE_PREBUILT_UI" false) + ]; + + # The base's update script tracks nixpkgs' llama-cpp attr, not this pin. + passthru = builtins.removeAttrs (old.passthru or { }) [ "updateScript" ] // { + category = "AI Inference"; + }; + })