llama-cpp: llama-server with DFlash2 speculative decoding for gfx1151

v0.8.0 is the first upstream release with DFlash2 drafters; nixpkgs has 0.6.0 (unstable) and an older tree (stable), so the engine is built here. HIP build for Strix Halo. The NixOS module exposes llama-server behind skyg.nixos.server.services.llama-cpp; fwdesk wires it to Qwen3.8-27B + its DFlash2 drafter, disabled until the weights are on disk.
This commit is contained in:
hermenix committed 2026-11-11 16:01:32 +00:00
1 parent 62c41a6f8e
commit ce92096042
9 files changed
+392

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ Packages here are exposed via an overlay defined in `modules/core/default.nix`.
| `buzz-desktop/` | Block Buzz desktop (Type-2 AppImage from `block/buzz`). Wrapped with `appimageTools.wrapType2` plus extra FHS libs (`elfutils`, `zstd`, WebKit/tray, GStreamer good/bad) so it runs on NixOS. Exposed as `pkgs.buzz-desktop` (`buzz-desktop` binary + desktop entry / icons). |
| `buzz-cli/` | Buzz CLI (`buzz`, `crates/buzz-cli` of `block/buzz`), built with `rustPlatform.buildRustPackage` from the same tag as `buzz-desktop`. Hermes's Buzz platform shells out to it. Bump with `update.sh` (sets the source hash, resets `cargoHash` to `lib.fakeHash`; build once and paste the `got:` hash). Robots call it with `pkgs.callPackage` (their nixpkgs has no host overlay). |
| `delta-editor/` | Delta Editor (Zed Industries' AI-native editor, `delta.dev`) prebuilt tarball. No stable URL exists — the release API returns a short-lived signed R2 link — so `src` is a fixed-output derivation that resolves the API at build time. Interpreter/RPATH patched (`--force-rpath`, `dontPatchELF`), dlopen'd graphics libs (`libglvnd`, `vulkan-loader`, `wayland`) added via wrapper, `XKB_CONFIG_ROOT` set for the bundled libxkbcommon. Exposed as `pkgs.delta-editor` (`delta-editor` binary + desktop entry / icons); named `-editor` to avoid clashing with the `delta` git diff pager. |
| `llama-cpp/` | llama.cpp pinned to v0.8.0, the first release with DFlash2 drafters (`--spec-type draft-dflash`). nixpkgs only carries v0.6.0 in the unstable input and an older tree in the stable one, so the server is built here. HIP build for Strix Halo (`CMAKE_HIP_ARCHITECTURES=gfx1151`, ROCm clang++, `autoPatchelfHook`). Backend-parameterized: `pkgs.llama-cpp-halo` (rocm, default) and `pkgs.llama-cpp-halo-cpu` (same tree, no GPU backend). Web UI is off — it downloads prebuilt assets at build time, which the sandbox cannot do. Model weights are not packaged. |
## Adding a New Package
+94
View File
@@ -0,0 +1,94 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
ninja,
pkg-config,
autoPatchelfHook,
rocmPackages,
# "rocm" builds the gfx1151 engine. "cpu" is the same tree without the GPU
# backend, so the recipe can be checked on a machine with no AMD card.
backend ? "rocm",
rocmArch ? "gfx1151",
}:
# llama.cpp, pinned to the first release that carries DFlash2 drafters
# (v0.8.0, 2026-10-28). nixpkgs only has v0.6.0 in the unstable input and an
# older tree in the stable one, and DFlash2 landed upstream after both — hence
# this package. Built for the Framework Desktop iGPU (Strix Halo, gfx1151).
#
# To bump: set `version` and `rev`, refresh `hash` with
# `nix-prefetch-url --unpack https://github.com/ggml-org/llama.cpp/archive/refs/tags/vX.Y.Z.tar.gz`
# then `nix hash convert --to sri <hash>`. Check the release notes for a new
# `--spec-type` before assuming a drafter still loads.
assert lib.elem backend [
"cpu"
"rocm"
];
let
rocmInputs = [
rocmPackages.clr
rocmPackages.rocm-runtime
rocmPackages.hipblas
rocmPackages.rocblas
];
in
stdenv.mkDerivation {
pname = "llama-cpp-halo" + lib.optionalString (backend == "cpu") "-cpu";
version = "0.8.0";
src = fetchFromGitHub {
owner = "ggml-org";
repo = "llama.cpp";
tag = "v0.8.0";
hash = "sha256-WQAtD8Hos6fEtgPQId7nZiLGyP4asAMKJYEXZid1nqc=";
};
nativeBuildInputs = [
cmake
ninja
pkg-config
]
++ lib.optionals (backend == "rocm") [
autoPatchelfHook
# Provides clang++ and the HIP headers; llama.cpp wants ROCm's own clang.
rocmPackages.clr
];
buildInputs = lib.optionals (backend == "rocm") rocmInputs;
# The web UI is a prebuilt asset downloaded at build time, which the sandbox
# cannot do. The API does not need it.
cmakeFlags = [
(lib.cmakeBool "GGML_NATIVE" false)
(lib.cmakeBool "BUILD_SHARED_LIBS" false)
(lib.cmakeBool "LLAMA_BUILD_SERVER" true)
(lib.cmakeBool "LLAMA_BUILD_TESTS" false)
(lib.cmakeBool "LLAMA_BUILD_EXAMPLES" false)
(lib.cmakeBool "LLAMA_BUILD_APP" false)
(lib.cmakeBool "LLAMA_BUILD_UI" false)
(lib.cmakeBool "LLAMA_USE_PREBUILT_UI" false)
(lib.cmakeBool "LLAMA_OPENSSL" false)
# Upstream reads these from git, which the release tarball does not carry.
(lib.cmakeFeature "LLAMA_BUILD_NUMBER" "31309")
(lib.cmakeFeature "LLAMA_BUILD_COMMIT" "8642541b2")
]
++ lib.optionals (backend == "rocm") [
(lib.cmakeBool "GGML_HIP" true)
(lib.cmakeFeature "CMAKE_HIP_COMPILER" "${rocmPackages.clr.hipClangPath}/clang++")
(lib.cmakeFeature "CMAKE_HIP_ARCHITECTURES" rocmArch)
];
doCheck = false;
meta = {
description = "llama.cpp server (DFlash2 speculative decoding) for AMD Strix Halo (gfx1151)";
homepage = "https://github.com/ggml-org/llama.cpp";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
mainProgram = "llama-server";
};
}