From 2563492fa465e7b4870389b6c07bcc24dcfd535e Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 18 Sep 2026 21:10:19 -0400 Subject: [PATCH] new ds4 from custom fork --- flake.lock | 17 ++++++++ flake.nix | 7 ++- hosts/hl-fwdesk.nix | 66 ++++++++++++++++++----------- modules/core/default.nix | 5 --- modules/lib.nix | 5 +-- modules/nixos/common/ssh-notify.nix | 14 +++++- 6 files changed, 79 insertions(+), 35 deletions(-) diff --git a/flake.lock b/flake.lock index d4c8bbe..3602c24 100644 --- a/flake.lock +++ b/flake.lock @@ -1695,6 +1695,22 @@ "type": "github" } }, + "my-nixpkgs": { + "locked": { + "lastModified": 1789765536, + "narHash": "sha256-zfNoP/NOzyLGneuOOuEOcEq/WON0L8BrusI10KiUhXU=", + "owner": "asosnovsky", + "repo": "nixpkgs", + "rev": "63c7314dd14de06c74455397a963185c09f52705", + "type": "github" + }, + "original": { + "owner": "asosnovsky", + "ref": "ds4-init", + "repo": "nixpkgs", + "type": "github" + } + }, "nix": { "inputs": { "flake-parts": "flake-parts", @@ -2374,6 +2390,7 @@ "home-manager": "home-manager_3", "hyprland": "hyprland", "hyprlauncher": "hyprlauncher", + "my-nixpkgs": "my-nixpkgs", "nix-darwin": "nix-darwin", "nix-flatpak": "nix-flatpak", "nix-index-database": "nix-index-database", diff --git a/flake.nix b/flake.nix index f6addcd..57fad7b 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,9 @@ determinate.inputs.nixpkgs.follows = "nixpkgs"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; nixpkgs-unstable.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; + # DwarfStar ds4 (package + nixos services.ds4 module) from the asosnovsky/nixpkgs + # fork, branch ds4-init (the implementation proposed for upstream). + my-nixpkgs.url = "github:asosnovsky/nixpkgs/ds4-init"; flox.url = "github:flox/flox/latest"; # nix-index database (for nix-index and comma) nix-index-database = { @@ -97,6 +100,7 @@ , stylix , hyprlauncher , hyprland + , my-nixpkgs , dms , dank-greeter , noctalia @@ -137,6 +141,7 @@ hyprlauncher hyprland nixpkgs-unstable + my-nixpkgs dms dank-greeter noctalia @@ -232,7 +237,7 @@ { openwrt-glmain = (openwrt (import ./openwrt-routers/glmain.nix)).deployScript; openwrt-glmain-dry-run = (openwrt (import ./openwrt-routers/glmain.nix)).dryRunScript; - ds4 = lib.pkgs.${system}.ds4; + ds4 = my-nixpkgs.legacyPackages.${system}.ds4; buzz-desktop = lib.pkgs.${system}.buzz-desktop; colibri = lib.pkgs.${system}.colibri; herdr = herdr.packages.${system}.default; diff --git a/hosts/hl-fwdesk.nix b/hosts/hl-fwdesk.nix index 9e9e27c..117565f 100644 --- a/hosts/hl-fwdesk.nix +++ b/hosts/hl-fwdesk.nix @@ -1,6 +1,8 @@ { pkgs , config , unstablePkgs +, ds4Pkgs +, my-nixpkgs , ... }: let @@ -32,7 +34,11 @@ let ]; in { - imports = [ ./hl-fwdesk.hardware-configuration.nix ]; + imports = [ + ./hl-fwdesk.hardware-configuration.nix + # DwarfStar ds4 systemd module (services.ds4) from asosnovsky/nixpkgs fork (branch ds4-init). + "${my-nixpkgs}/nixos/modules/services/misc/ds4.nix" + ]; # Skyg environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = 1; environment.sessionVariables.ELECTRON_OZONE_PLATFORM_HINT = "wayland"; @@ -71,26 +77,6 @@ in dataDir = "/data/comfyui"; }; }; - server.services.ds4 = { - enable = true; - package = pkgs.ds4-rocm; - model = "/var/lib/ds4/ds4flash.gguf"; - host = "0.0.0.0"; - port = ports.ds4; - ctx = 100000; - kvDiskDir = "/var/lib/ds4/kv"; - kvDiskSpaceMb = 8192; - kvCacheRejectDifferentQuant = true; - cors = true; - environment = { - HSA_ENABLE_SDMA = "0"; - }; - openFirewall = true; - autoStart = false; - extraServiceConfig = { - TimeoutStopSec = "300"; - }; - }; server.services.colibri = { enable = false; package = pkgs.colibri-rocm; @@ -105,6 +91,37 @@ in enable = true; }; }; + # DwarfStar (antirez/ds4) inference server — services.ds4 module from + # asosnovsky/nixpkgs (ds4-init fork branch); package is the fork's ROCm + # build for Strix Halo (gfx1151), see flake.nix: + services.ds4 = { + enable = true; + # Strix Halo == gfx1151. Pin explicitly: the fork package's auto-detected + # default can pick the wrong arch on non-GPU eval hosts (see fix on + # asosnovsky/nixpkgs ds4-init), and this host must always build gfx1151. + package = (ds4Pkgs.ds4-rocm.override { rocmArch = "gfx1151"; }); + # Run as the existing ari account (the old skyg module default), so the + # ari-owned /var/lib/ds4 model + kv cache keep their current ownership. + user = "ari"; + group = "users"; + model = "/var/lib/ds4/ds4flash.gguf"; + host = "0.0.0.0"; + port = ports.ds4; + ctx = 100000; + kvDiskDir = "/var/lib/ds4/kv"; + kvDiskSpaceMb = 8192; + cors = true; + environment = { + HSA_ENABLE_SDMA = "0"; + }; + openFirewall = true; + autoStart = false; + # Not a services.ds4 option in the fork module yet; pass the flag through. + extraArgs = [ "--kv-cache-reject-different-quant" ]; + extraServiceConfig = { + TimeoutStopSec = "300"; + }; + }; users.users.ari.extraGroups = [ "input" "disk" @@ -168,16 +185,15 @@ in unstablePkgs.grok-build # stable-diffusion-cpp-rocm lmstudio - # DwarfStar (antirez/ds4) — ROCm build for Strix Halo (gfx1151). - ds4-rocm - # Hermes gateway - Signal bridge (used to link the device + run the daemon) signal-cli # bluetooth blueman - ]); + ]) + # DwarfStar (antirez/ds4) — ROCm build for Strix Halo (gfx1151), from the fork. + ++ [ ds4Pkgs.ds4-rocm ]; services.usbmuxd.enable = true; # Steam programs.steam = { diff --git a/modules/core/default.nix b/modules/core/default.nix index c9aa00a..be90674 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -16,11 +16,6 @@ (final: _prev: { # xAI Grok CLI — prebuilt binary, see pkgs/grok-cli. grok-cli = final.callPackage ../../pkgs/grok-cli { }; - # DwarfStar (antirez/ds4) inference engine, see pkgs/ds4. - # Backend-parameterized: cpu (default), rocm (Strix Halo), cuda. - 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 { }; diff --git a/modules/lib.nix b/modules/lib.nix index 2d12bbc..5b84bb7 100644 --- a/modules/lib.nix +++ b/modules/lib.nix @@ -28,9 +28,6 @@ let overlays = [ (final: _prev: { grok-cli = final.callPackage ../pkgs/grok-cli { }; - # 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 { }; @@ -105,6 +102,8 @@ in specialArgs = specialArgs // { inherit system skygUtils user; unstablePkgs = allUnstablePkgs.${system}; + # DwarfStar ds4 from asosnovsky/nixpkgs (ds4-init fork branch), see flake.nix. + ds4Pkgs = specialArgs.my-nixpkgs.legacyPackages.${system}; }; inherit system; modules = osModules ++ [ diff --git a/modules/nixos/common/ssh-notify.nix b/modules/nixos/common/ssh-notify.nix index b84a576..ab11166 100644 --- a/modules/nixos/common/ssh-notify.nix +++ b/modules/nixos/common/ssh-notify.nix @@ -46,7 +46,10 @@ in }; config = lib.mkIf cfg.enable { - environment.systemPackages = [ pkgs.ssh-notify ]; + # hiPrio: desktop hosts (e.g. hl-fwdesk) also pull in the real libnotify + # via the tiler module's "always-on plumbing" packages, and both provide + # bin/notify-send. Force ours to win that collision unconditionally. + environment.systemPackages = [ (lib.hiPrio pkgs.ssh-notify) ]; # Client: ask SSH to forward this connection's notification socket back # to the shared local listener, and tell the server-side wrapper (via @@ -61,6 +64,15 @@ in # above (SSH only passes through an allow-listed set by default). services.openssh.settings.AcceptEnv = lib.mkIf isServer [ "SSH_NOTIFY_SOCK" ]; + # %C is a deterministic hash of (local host, remote user, remote host, + # remote port) -- the same value every time you connect to this host + # from this client, not a per-connection nonce. Without this, a socket + # left behind by an abnormally-ended session (network drop, kill) blocks + # every subsequent connection to the same host with "remote port + # forwarding failed for listen path ...". Tell sshd to unlink and rebind + # instead of refusing. + services.openssh.settings.StreamLocalBindUnlink = lib.mkIf isServer true; + # Client listener: one persistent socket, forked per connection, that # turns each incoming JSON payload into a real local notification. systemd.user.services.ssh-notify-listener = lib.mkIf isClient {