From 4bc5df11c456093418a53da34e3aa309d520e4df Mon Sep 17 00:00:00 2001 From: Alexander Miroshnichenko Date: Fri, 19 Jun 2026 23:06:42 +0300 Subject: [PATCH] feat(packages): add ds4 package with ROCm/Strix Halo backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add antirez/ds4 — DeepSeek V4 Flash/PRO local inference engine built with the ROCm strix-halo target for AMD Radeon 8060S (gfx1151). Wires up all 8 ROCm transitive dependencies (clr, hipblas, hipblas-common, hipblaslt, hipcub, rocblas, rocprim, rocwmma) via explicit include/lib paths. --- README.md | 2 + packages/ds4/default.nix | 2 + packages/ds4/package.nix | 102 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 packages/ds4/default.nix create mode 100644 packages/ds4/package.nix diff --git a/README.md b/README.md index 42b07d8..493a397 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ A custom Nix overlay and flake providing additional packages not found in upstre | `aionui` | Free, open-source, Cowork app with AI Agents | AI Coding Agents | | `container-use` | Containerized environments for coding agents | AI Coding Agents | | `desloppify` | Multi-language codebase health scanner and technical debt tracker for AI agents | AI Coding Agents | +| `ds4` | DeepSeek 4 Flash and PRO local inference engine for ROCm (Strix Halo) | AI Inference | | `freebuff` | The world's strongest free coding agent | AI Coding Agents | | `graphify` | Turn any folder of code, docs, papers, images, or videos into a queryable knowledge graph | AI Coding Agents | | `hipengine` | ROCm-native local LLM inference engine with torch-free runtime for AMD RDNA GPUs | AI Inference | @@ -115,6 +116,7 @@ nix-overlay/ │ ├── container-use/ # Containerized environments for coding agents │ ├── default/ # Meta-package listing all packages │ ├── desloppify/ # Codebase health scanner for AI agents +│ ├── ds4/ # DeepSeek V4 Flash/PRO inference engine (ROCm) │ ├── flake-inputs/ # Utility for caching flake inputs │ ├── freebuff/ # Free coding agent (Codebuff) │ ├── graphify/ # Knowledge graph generator for code folders diff --git a/packages/ds4/default.nix b/packages/ds4/default.nix new file mode 100644 index 0000000..69b1a07 --- /dev/null +++ b/packages/ds4/default.nix @@ -0,0 +1,2 @@ +{ pkgs, ... }: +pkgs.callPackage ./package.nix { } diff --git a/packages/ds4/package.nix b/packages/ds4/package.nix new file mode 100644 index 0000000..a3a0546 --- /dev/null +++ b/packages/ds4/package.nix @@ -0,0 +1,102 @@ +{ + lib, + stdenv, + fetchFromGitHub, + gnumake, + rocmPackages, + autoPatchelfHook, +}: + +stdenv.mkDerivation { + pname = "ds4"; + version = "0-unstable-2026-06-17"; + + src = fetchFromGitHub { + owner = "antirez"; + repo = "ds4"; + rev = "80ebbc396aee40eedc1d829222f3362d10fa4c6c"; + hash = "sha256-Ieuc72GHZs20ModQfnvI5Me31n4Pj+WFYtsuqaKJceo="; + }; + + nativeBuildInputs = [ + gnumake + rocmPackages.hipcc + autoPatchelfHook + ]; + + buildInputs = [ + rocmPackages.clr + rocmPackages.hipblas + rocmPackages.hipblas-common + rocmPackages.hipblaslt + rocmPackages.hipcub + rocmPackages.rocblas + rocmPackages.rocprim + rocmPackages.rocwmma + ]; + + # STRIXHALO.md: rocwmma/internal/ headers may be missing in distro packages. + # nixpkgs builds rocwmma from source so all headers (including internal/) are present. + # ROCM_ARCH defaults to gfx1151 (Strix Halo / Radeon 8060S) in the upstream Makefile. + buildPhase = '' + runHook preBuild + + make strix-halo -j"$NIX_BUILD_CORES" \ + HIPCC="${rocmPackages.hipcc}/bin/hipcc" \ + ROCM_CFLAGS="-O3 -ffast-math -g -fno-finite-math-only -pthread -D__HIP_PLATFORM_AMD__ -Wno-unused-command-line-argument --offload-arch=gfx1151 \ + -I${rocmPackages.clr}/include \ + -I${rocmPackages.hipblas}/include \ + -I${rocmPackages.hipblas-common}/include \ + -I${rocmPackages.hipblaslt}/include \ + -I${rocmPackages.hipcub}/include \ + -I${rocmPackages.rocblas}/include \ + -I${rocmPackages.rocprim}/include \ + -I${rocmPackages.rocwmma}/include" \ + ROCM_LDLIBS="-lm -pthread \ + -L${rocmPackages.hipblas}/lib -lhipblas \ + -L${rocmPackages.hipblaslt}/lib -lhipblaslt \ + -L${rocmPackages.rocblas}/lib -lrocblas \ + -L${rocmPackages.clr}/lib -lamdhip64" + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp ds4 ds4-server ds4-bench ds4-eval ds4-agent $out/bin/ + + runHook postInstall + ''; + + passthru = { + category = "AI Inference"; + updateScript = [ + "nix-update" + "--flake" + "--version=branch=main" + ".#ds4" + ]; + }; + + meta = { + description = "DeepSeek 4 Flash and PRO local inference engine for ROCm (Strix Halo)"; + longDescription = '' + DS4 is a self-contained local inference engine specifically built for + DeepSeek V4 Flash and PRO. It bundles a CLI, HTTP server, and native + coding agent. This package is built with the ROCm backend for AMD + Strix Halo GPUs (gfx1151, Radeon 8060S). + + Runtime requirements (from STRIXHALO.md): + - User must be in 'render' and 'video' groups for /dev/kfd and DRM access + - GPU-visible memory must be increased via kernel parameters: + amd_iommu=off amdgpu.gttsize=126976 ttm.pages_limit=32505856 ttm.page_pool_size=32505856 + ''; + homepage = "https://github.com/antirez/ds4"; + changelog = "https://github.com/antirez/ds4/commits/main"; + license = lib.licenses.mit; + platforms = [ "x86_64-linux" ]; + mainProgram = "ds4"; + }; +}