From 92d10f3f09bd3b5d6abf0f81b6ffdb5ed4fe85ad Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 7 Aug 2026 17:08:22 -0400 Subject: [PATCH] colibri --- hosts/hl-fwdesk.nix | 11 +++++ modules/core/default.nix | 4 ++ modules/lib.nix | 1 + modules/nixos/common/core.nix | 3 -- modules/nixos/server/services/colibri.nix | 11 ++++- pkgs/ABOUTME.md | 1 + pkgs/colibri/default.nix | 47 ++++++++++++++++++---- secrets/hermes-env.age | Bin 1170 -> 1277 bytes 8 files changed, 67 insertions(+), 11 deletions(-) diff --git a/hosts/hl-fwdesk.nix b/hosts/hl-fwdesk.nix index 1931364..ea5f009 100644 --- a/hosts/hl-fwdesk.nix +++ b/hosts/hl-fwdesk.nix @@ -14,6 +14,7 @@ let comfyui = 8188; libretranslate = 5000; ds4 = 8000; + colibri = 8001; hermes = 8642; hermesDashboard = 9119; vnc = 5930; @@ -78,6 +79,15 @@ in openFirewall = true; autoStart = false; }; + server.services.colibri = { + enable = false; + package = pkgs.colibri-rocm; + model = "/var/lib/colibri/glm52_i4"; + host = "0.0.0.0"; + port = ports.colibri; + autoStart = false; + openFirewall = true; + }; }; networkDrives = { enable = true; @@ -220,6 +230,7 @@ in environment = { PUID = "1000"; PGID = "100"; + HERMES_HOME = "/opt/data"; }; shm_size = "1g"; extra_hosts = [ "host.docker.internal:host-gateway" ]; diff --git a/modules/core/default.nix b/modules/core/default.nix index fccf735..b22fb24 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -19,6 +19,10 @@ ds4 = final.callPackage ../../pkgs/ds4 { }; ds4-rocm = final.callPackage ../../pkgs/ds4 { backend = "rocm"; }; ds4-cuda = final.callPackage ../../pkgs/ds4 { backend = "cuda"; }; + # colibrì (JustVugg/colibri) — GLM-5.2/OLMoE local inference, see pkgs/colibri. + # Backend-parameterized: cpu (default), rocm (Strix Halo). + colibri = final.callPackage ../../pkgs/colibri { }; + colibri-rocm = final.callPackage ../../pkgs/colibri { backend = "rocm"; }; # Touchscreen gesture bridge for niri, see pkgs/niri-touchscreen-gestures. niri-touchscreen-gestures = final.callPackage ../../pkgs/niri-touchscreen-gestures { }; # Buzz Desktop AppImage wrapper, see pkgs/buzz-desktop. diff --git a/modules/lib.nix b/modules/lib.nix index fc9f839..4069c67 100644 --- a/modules/lib.nix +++ b/modules/lib.nix @@ -29,6 +29,7 @@ let # CPU variant only here (buildable on any system); the GPU variants # need their toolchains and are wired in modules/core/default.nix. ds4 = final.callPackage ../pkgs/ds4 { }; + colibri = final.callPackage ../pkgs/colibri { }; niri-touchscreen-gestures = final.callPackage ../pkgs/niri-touchscreen-gestures { }; buzz-desktop = final.callPackage ../pkgs/buzz-desktop { }; }) diff --git a/modules/nixos/common/core.nix b/modules/nixos/common/core.nix index 85cd176..7cb1c9e 100644 --- a/modules/nixos/common/core.nix +++ b/modules/nixos/common/core.nix @@ -14,9 +14,6 @@ clean.enable = true; }; environment.systemPackages = with pkgs; [ - # nix utils - appimage-run - # shell tools git usbutils diff --git a/modules/nixos/server/services/colibri.nix b/modules/nixos/server/services/colibri.nix index 37b73f7..fa8acee 100644 --- a/modules/nixos/server/services/colibri.nix +++ b/modules/nixos/server/services/colibri.nix @@ -233,6 +233,15 @@ in type = types.bool; }; + autoStart = mkOption { + description = '' + Whether to start colibri-serve automatically at boot. + Set to false to only start it on demand via `systemctl start colibri-serve`. + ''; + default = true; + type = types.bool; + }; + extraArgs = mkOption { description = "Additional arguments to append to the coli serve command line."; default = [ ]; @@ -272,7 +281,7 @@ in after = [ "network-online.target" ]; wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; + wantedBy = lib.optionals cfg.autoStart [ "multi-user.target" ]; serviceConfig = { Type = "simple"; diff --git a/pkgs/ABOUTME.md b/pkgs/ABOUTME.md index 4f3a8f9..3c5330b 100644 --- a/pkgs/ABOUTME.md +++ b/pkgs/ABOUTME.md @@ -9,6 +9,7 @@ Packages here are exposed via an overlay defined in `modules/core/default.nix`. |---|---| | `grok-cli/` | xAI Grok CLI — prebuilt static binary, fetched per-platform. Exposed as `pkgs.grok-cli`. | | `ds4/` | DwarfStar (`antirez/ds4`) DeepSeek V4 local inference engine, built from source. Backend-parameterized (`backend = "cpu" \| "rocm" \| "cuda"`); tracks `main` and builds per-host. Exposed as `pkgs.ds4` (cpu, default), `pkgs.ds4-rocm` (Strix Halo / gfx1151), `pkgs.ds4-cuda`. Installs the `ds4`, `ds4-server`, `ds4-bench`, `ds4-eval`, `ds4-agent` binaries plus a `ds4-download-model` helper for fetching GGUF weights. Model weights are a runtime concern and not packaged. | +| `colibri/` | colibrì (`JustVugg/colibri`) — GLM-5.2/OLMoE local inference engine, built from source, pinned to a tagged release. Backend-parameterized (`backend = "cpu" \| "rocm"`). Exposed as `pkgs.colibri` (cpu, default), `pkgs.colibri-rocm` (Strix Halo / gfx1151). Installs the `coli` CLI (wrapped with the Python env its converter/bench subcommands need) plus the bundled `colibri`/`olmoe` engine binaries. Model weights are a runtime concern and not packaged. | | `niri-touchscreen-gestures/` | Python daemon that reads multi-touch events from a touchscreen via `evdev`, detects 2/3/4-finger swipes (up/down/left/right), and dispatches configurable `niri msg action` commands. Configured via TOML; exposed as `pkgs.niri-touchscreen-gestures`. | | `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). | diff --git a/pkgs/colibri/default.nix b/pkgs/colibri/default.nix index 1247384..af50b89 100644 --- a/pkgs/colibri/default.nix +++ b/pkgs/colibri/default.nix @@ -38,12 +38,42 @@ let ] ); + # ROCm inputs for the HIP build. hipcc is the raw ROCm compiler, not the + # nix cc-wrapper, so it needs explicit -I include paths to find the HIP + # runtime + rocWMMA headers. rocWMMA defines COLI_GPU_HAS_WMMA in + # backend_gpu_compat.h; without its include dir that macro is undeclared and + # backend_cuda.cu fails to compile (mirrors the ds4 rocm build inputs). + rocmInputs = lib.optionals (backend == "rocm") [ + rocmPackages.clr # provides hipcc + HIP runtime + rocmPackages.rocm-runtime + rocmPackages.hipblas + rocmPackages.hipblas-common + rocmPackages.hipblaslt + rocmPackages.rocblas + rocmPackages.rocwmma # gfx1151 backend uses rocWMMA headers + rocmPackages.hipcub + rocmPackages.rocprim + rocmPackages.rocthrust + ]; + + rocmIncludeFlags = + lib.concatStringsSep " " + (map (p: "-I${lib.getDev p}/include") rocmInputs); + hipMakeFlags = lib.optionals (backend == "rocm") [ "HIP=1" "HIP_ARCH=${rocmArch}" "ROCM_HOME=${rocmPackages.clr}" "HIPCC=${rocmPackages.clr}/bin/hipcc" ]; + + # HIPCCFLAGS is the Makefile's GPU compile flags (GPUFLAGS). It contains + # spaces, so it must go through makeFlagsArray (a quoted bash array) rather + # than makeFlags, which the generic builder word-splits. This reproduces the + # upstream default flags and appends the rocm include paths. + hipMakeFlagsArray = lib.optionals (backend == "rocm") [ + "HIPCCFLAGS=-O3 -std=c++17 -x hip --offload-arch=${rocmArch} -Wall -Wextra -fPIE ${rocmIncludeFlags}" + ]; in stdenv.mkDerivation { pname = "colibri" + lib.optionalString (backend == "rocm") "-rocm"; @@ -53,15 +83,11 @@ stdenv.mkDerivation { owner = "JustVugg"; repo = "colibri"; rev = "8f512fc8c2f48ffa18cd624cd4a5bcaae4a4abfc"; # tag v1.5.0 - hash = lib.fakeHash; # replace with the real hash on first build attempt + hash = "sha256-SW5RDghfITxblAI+nZGVCHULrTQxskzdNHguJkSMfN4="; }; nativeBuildInputs = [ makeWrapper ]; - buildInputs = lib.optionals (backend == "rocm") [ - rocmPackages.clr - rocmPackages.rocm-runtime - rocmPackages.hipblas - ]; + buildInputs = rocmInputs; # python3 is needed by checkPhase: `make test-c` shells out to # `python3 tools/run_tests.py`. @@ -71,7 +97,14 @@ stdenv.mkDerivation { ARCH = if stdenv.hostPlatform.isx86_64 then "x86-64-v3" else "native"; makeFlags = [ "-C" "c" ] ++ hipMakeFlags; - buildFlags = [ "colibri" "olmoe" ]; + + # Pass space-containing make variables as a quoted array so they aren't + # word-split (see hipMakeFlagsArray note above). + preBuild = lib.optionalString (hipMakeFlagsArray != [ ]) '' + makeFlagsArray+=(${lib.escapeShellArgs hipMakeFlagsArray}) + ''; + + buildFlags = [ "colibri" "olmoe" "deepseek-v4" ]; # Use upstream's own install target instead of hand-copying files — it # installs `coli` to bin/ and the engine + support modules to diff --git a/secrets/hermes-env.age b/secrets/hermes-env.age index f2e55451f2d9f61d973a41cde21202c9c90cce08..c2520b03f1f7870e435545fba756ba8e2844a51a 100644 GIT binary patch delta 1249 zcmV<71Rnd63H=F>EPpgvub9Gu%N_avtPfc}BOk*)LNGobZc4jnjS1VCx zNl`&~FbYgjGcYrAR4-LjVPa}hQ8Q*mXES$cMnza?G)77=Sw=BeX=r+SZ8bqwV+t)k zAaiqQEoEdfH8n9gAZL0^RCjkEG*35adSfwhHgaosZEZ$)SARosPgXQbPB=wjbZ1B~ zQgKB^c1?P4M`}Yf3Q}r8S79+PWj9EAb!2L6K~zdqWOi*(RaQ7LcP~XYbVpGycXdit zcQ`^>3N0-yAVM)xW>`X1a87hFcXd-SH8eL)GF34$Zc{~CGImQcRBLZ>QZQv}N>ge< z3IbGSZVtCs%YREi7+OecRU5l!Kpe|(5{m@Dw}JVjLB2bWfv{tC%3jvOfHs4vWRdJnamoz z08QbRZuBb*hHH&48o>dyPeA_|fd{?cx^dI|h1(t5XMZnzf9^2r6Bl0d;%QW3C*ij$ zCl5}uu{myV&<#b^Dw!u|EvOLkA_p5QFqOzT4+Z(xySUbS7WDfgi-9CeNUSGI!{C*$ zrla0UV;E5kS?VIPz!Gzs^&AIYRrH_qA4ELrLv*hnox5`nnSS!rMd4jmcwpiTwWgIFH8Lt=F9BO z4r&FS*Pagt+EBghK{AuW@@-jgC1)W8-K_EM=x6ce%dH>Tqk*LQ{5>ocbOJG zg5Yj1qvSX{;T(}^Ew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