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 f2e5545..c2520b0 100644 Binary files a/secrets/hermes-env.age and b/secrets/hermes-env.age differ