clean up of ds4 (using my fork of it instead) + update scripts!!!
This commit is contained in:
1 parent
fd5bb0af6e
commit
507d603ef0
20 files changed
+209
-837
No files matched your search
@@ -9,7 +9,7 @@ nixos-setup/
|
||||
├── bin/
|
||||
│ └── skyg # Main CLI tool for managing NixOS configurations
|
||||
├── configs/ # Application-specific configurations
|
||||
├── pkgs/ # Custom packages (niri-touchscreen-gestures, grok-cli, ds4)
|
||||
├── pkgs/ # Custom packages (niri-touchscreen-gestures, grok-cli)
|
||||
├── hosts/ # Host-specific NixOS configurations
|
||||
│ ├── *.nix # Host configuration files (fwbook, hl-bigbox1, hl-minipc*, etc.)
|
||||
│ ├── *.hardware-configuration.nix # Hardware-specific configurations
|
||||
@@ -40,7 +40,6 @@ To use the custom packages in your own NixOS/Home Manager configuration:
|
||||
in {
|
||||
environment.systemPackages = with pkgs; [
|
||||
niri-touchscreen-gestures
|
||||
ds4
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -50,8 +49,6 @@ You can also import `nixos-setup.lib` to reuse `makeNixOs`, `makeHomeManagerUser
|
||||
|
||||
See [`pkgs/ABOUTME.md`](pkgs/ABOUTME.md) for details on each package.
|
||||
|
||||
**Key packages:** `niri-touchscreen-gestures` (run `niri-touchscreen-gestures` — uses built-in defaults), and `ds4` (local LLM inference with CPU/ROCm/CUDA support).
|
||||
|
||||
## Quick Start
|
||||
|
||||
The `skyg` script is your main interface for managing these configurations. It's located in `bin/skyg` and uses NuShell.
|
||||
@@ -129,7 +126,7 @@ All packages from `pkgs/` are available in your configuration as `pkgs.<name>` t
|
||||
Example:
|
||||
|
||||
```nix
|
||||
environment.systemPackages = with pkgs; [ niri-touchscreen-gestures ds4 ];
|
||||
environment.systemPackages = with pkgs; [ niri-touchscreen-gestures ];
|
||||
```
|
||||
|
||||
See [`pkgs/ABOUTME.md`](pkgs/ABOUTME.md) for details on each package.
|
||||
|
||||
+67
-1
@@ -455,7 +455,7 @@ export def "skyg encrypt" [
|
||||
}
|
||||
|
||||
# Compare unencrypted local version with encrypted version of a secret
|
||||
export def "skyg compare-secret" [secret: string] {
|
||||
export def "skyg compare-secret" [secret: string@secret-names] {
|
||||
cd $REPO_ROOT
|
||||
let unencrypted = $".tmp/unencrypted-($secret)"
|
||||
let encrypted = $"secrets/($secret).age"
|
||||
@@ -543,3 +543,69 @@ export def "skyg ca issue" [
|
||||
print $"✅ Key encrypted: ($secret)"
|
||||
print $"Wire it up: age.secrets.($slug)-tls-key.file = ../($secret);"
|
||||
}
|
||||
|
||||
|
||||
# Update one or all packages. With a version, bumps explicitly.
|
||||
# Without a version, auto-detects the latest from upstream.
|
||||
#
|
||||
# skyg pkgs update --all
|
||||
# skyg pkgs update buzz-desktop
|
||||
# skyg pkgs update buzz-desktop 0.6.0
|
||||
export def "skyg pkgs update" [
|
||||
pkg_name?: string@updatable-pkgs # Package to update (omit with --all)
|
||||
version?: string # Explicit version (omit for auto-detect)
|
||||
--all # Update all packages that have update.sh
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
|
||||
if $all and $version != null {
|
||||
error make {msg: "Cannot use --all with a specific version. Run without --all to bump a single package."}
|
||||
}
|
||||
|
||||
let targets = if $all {
|
||||
updatable-pkgs
|
||||
} else if $pkg_name != null {
|
||||
[$pkg_name]
|
||||
} else {
|
||||
error make {msg: "Specify a package name or use --all to update all packages"}
|
||||
}
|
||||
|
||||
if ($targets | length) == 0 {
|
||||
print "No updatable packages found (no pkgs/*/update.sh scripts)"
|
||||
return
|
||||
}
|
||||
|
||||
print $"Updating ($targets | length) package\(s): ($targets | str join ', ')"
|
||||
print ""
|
||||
|
||||
for pkg in $targets {
|
||||
let update_script = $"pkgs/($pkg)/update.sh"
|
||||
if not ($update_script | path exists) {
|
||||
print $"⚠️ Skipping ($pkg) — no update.sh"
|
||||
continue
|
||||
}
|
||||
|
||||
print $"=== ($pkg) ==="
|
||||
cd $"pkgs/($pkg)"
|
||||
try {
|
||||
if $version != null {
|
||||
bash $"update.sh ($version)" | print
|
||||
} else {
|
||||
bash "update.sh" | print
|
||||
}
|
||||
} catch { |e|
|
||||
print $"❌ Failed to update ($pkg): ($e)"
|
||||
}
|
||||
cd $REPO_ROOT
|
||||
print ""
|
||||
}
|
||||
|
||||
print ""
|
||||
if $version != null {
|
||||
print "Bump complete. Review with:"
|
||||
git --no-pager diff pkgs/ | print
|
||||
} else {
|
||||
print "All updates complete. Review with:"
|
||||
git --no-pager diff pkgs/ | print
|
||||
}
|
||||
}
|
||||
@@ -23,3 +23,9 @@ export def secret-names [] {
|
||||
cd $REPO_ROOT
|
||||
glob secrets/*.age | each {|f| $f | path basename | str replace ".age" "" }
|
||||
}
|
||||
|
||||
export def updatable-pkgs [] {
|
||||
cd $REPO_ROOT
|
||||
glob "pkgs/*/update.sh"
|
||||
| each {|f| $f | path dirname | path basename }
|
||||
}
|
||||
@@ -66,11 +66,7 @@
|
||||
|
||||
# Secrets management
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
# Claude Desktop
|
||||
claude-desktop = {
|
||||
url = "github:patrickjaja/claude-desktop-extra";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Tether — iPhone ↔ Linux Wayland bridge
|
||||
tether = {
|
||||
url = "github:zackb/tether";
|
||||
@@ -109,7 +105,6 @@
|
||||
, hermes-agent
|
||||
, tether
|
||||
, herdr
|
||||
, claude-desktop
|
||||
, disko
|
||||
}:
|
||||
let
|
||||
@@ -146,7 +141,6 @@
|
||||
noctalia
|
||||
nix-index-database
|
||||
hermes-agent
|
||||
claude-desktop
|
||||
skygqts
|
||||
hermenix
|
||||
flox
|
||||
|
||||
@@ -235,7 +235,6 @@ in
|
||||
idevicerestore # optional, to mount using 'ifuse'
|
||||
|
||||
# coding agents
|
||||
claude-desktop
|
||||
unstablePkgs.grok-build
|
||||
unstablePkgs.pi-coding-agent
|
||||
unstablePkgs.goose-cli
|
||||
|
||||
@@ -17,8 +17,7 @@ core/
|
||||
|
||||
## What lives here
|
||||
|
||||
- **Overlays** (`default.nix`): exposes the `pkgs/` packages — `grok-cli`, `ds4`
|
||||
(+`ds4-rocm`/`ds4-cuda`), `colibri` (+`colibri-rocm`), `niri-touchscreen-gestures`,
|
||||
- **Overlays** (`default.nix`): exposes the `pkgs/` packages — `grok-cli`, `colibri` (+`colibri-rocm`), `niri-touchscreen-gestures`,
|
||||
`buzz-desktop`, — and patches `python3Packages.pipx` to skip its flaky install check on nixpkgs 26.05.
|
||||
- **Distributed builds** (`default.nix`): registers `bigbox1.lab.internal` and
|
||||
`fwdesk.lab.internal` as remote `x86_64-linux` build machines and enables
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib, herdr, flox, claude-desktop, skygqts, hermenix, ... }:
|
||||
{ lib, herdr, flox, skygqts, hermenix, ... }:
|
||||
{
|
||||
imports = [
|
||||
./user.nix
|
||||
@@ -25,8 +25,6 @@
|
||||
# Superset Desktop AppImage wrapper, see pkgs/superset-desktop.
|
||||
superset-desktop = final.callPackage ../../pkgs/superset-desktop { };
|
||||
|
||||
# Claude Desktop (Linux), see pkgs/claude-desktop.
|
||||
claude-desktop = claude-desktop.packages.${final.stdenv.hostPlatform.system}.default;
|
||||
# herdr (herdrdev/herdr) — see flake.nix input.
|
||||
herdr = herdr.packages.${final.stdenv.hostPlatform.system}.default;
|
||||
# flox (flox/flox) — see flake.nix input.
|
||||
|
||||
@@ -12,7 +12,6 @@ services/
|
||||
├── default.nix # imports the services below
|
||||
├── ai-services.nix # skyg.nixos.server.services.ai — Wyoming (whisper/piper/wake)
|
||||
├── audiobookshelf.nix # skyg.nixos.server.services.audiobookshelf — audiobook/podcast server
|
||||
├── ds4.nix # skyg.nixos.server.services.ds4 — ds4-server HTTP API (DwarfStar local inference)
|
||||
├── jellyfin.nix # skyg.nixos.server.services.jellyfin — media server (uid/gid 7777)
|
||||
├── signal-cli.nix # skyg.nixos.server.services.signal-cli — signal-cli HTTP daemon (Hermes Signal bridge)
|
||||
├── colibri.nix # skyg.nixos.server.services.colibri — coli serve HTTP API (GLM-5.2/OLMoE local inference)
|
||||
@@ -23,12 +22,8 @@ services/
|
||||
|
||||
- **`ai-services.nix`** openwakeword as containers and
|
||||
enables NixOS-native Wyoming faster-whisper + piper. Opens 11434/10200/10300/10400.
|
||||
- **`ds4.nix`** runs `ds4-server` (the OpenAI/Anthropic-compatible HTTP API for DwarfStar
|
||||
DeepSeek V4 inference) as a native systemd service. `package` selects the backend
|
||||
(`pkgs.ds4` cpu / `pkgs.ds4-rocm` / `pkgs.ds4-cuda`); model path, ctx, KV offload, and
|
||||
GPU device IDs are all options.
|
||||
- **`colibri.nix`** runs `coli serve` (colibrì's OpenAI-compatible API) as a native systemd
|
||||
service, mirroring `services/ds4.nix`'s shape. `package` picks the backend (`pkgs.colibri`
|
||||
service. `package` picks the backend (`pkgs.colibri`
|
||||
cpu / `pkgs.colibri-rocm`); `environmentFile` supplies `COLI_API_KEY` via agenix instead of
|
||||
a CLI flag.
|
||||
|
||||
@@ -37,7 +32,6 @@ services/
|
||||
```
|
||||
skyg.nixos.server.services.ai.enable
|
||||
skyg.nixos.server.services.audiobookshelf.{enable,package,configDir,dataDir}
|
||||
skyg.nixos.server.services.ds4.{enable,package,model,host,port,ctx,kvDiskDir,...}
|
||||
skyg.nixos.server.services.jellyfin.enable
|
||||
skyg.nixos.server.services.signal-cli.{enable,host,port,configDir,account,environmentFile,openFirewall}
|
||||
skyg.nixos.server.services.colibri.{enable,package,model,host,port,environmentFile,openFirewall,...}
|
||||
|
||||
@@ -304,7 +304,7 @@ in
|
||||
|
||||
# No custom ExecStop: `coli serve` runs in the foreground and systemd's
|
||||
# default cgroup-wide kill on stop takes down its spawned engine
|
||||
# subprocess with it (same reasoning as ds4-server).
|
||||
# subprocess with it
|
||||
Restart = "on-failure";
|
||||
RestartSec = 10;
|
||||
StartLimitBurst = 3;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
./ai-services.nix
|
||||
./colibri.nix
|
||||
./comfyui
|
||||
./ds4.nix
|
||||
./jellyfin.nix
|
||||
./signal-cli.nix
|
||||
];
|
||||
|
||||
@@ -1,367 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.skyg.nixos.server.services.ds4;
|
||||
skygUser = config.skyg.user;
|
||||
|
||||
# The ds4 package variant to use: ds4 (cpu), ds4-rocm, ds4-cuda.
|
||||
ds4Pkg = cfg.package;
|
||||
|
||||
# Build the ds4-server command line from options.
|
||||
# optionalString returns "" when false; filter those out so we don't get
|
||||
# spurious leading/trailing whitespace in the final command line.
|
||||
serverArgs = with cfg;
|
||||
concatStringsSep " " (filter (x: x != "") [
|
||||
"-m ${escapeShellArg model}"
|
||||
|
||||
"--host ${host}"
|
||||
"--port ${toString port}"
|
||||
|
||||
(optionalString (ctx != null) "--ctx ${toString ctx}")
|
||||
(optionalString (tokens != null) "--tokens ${toString tokens}")
|
||||
(optionalString (threads != null) "--threads ${toString threads}")
|
||||
(optionalString (power != null) "--power ${toString power}")
|
||||
(optionalString (prefillChunk != null) "--prefill-chunk ${toString prefillChunk}")
|
||||
(optionalString (batchedSession != null) "--batched-session ${toString batchedSession}")
|
||||
(optionalString (mixedPrefillQuantum != null) "--mixed-prefill-quantum ${toString mixedPrefillQuantum}")
|
||||
(optionalString (vision != null) "--vision ${escapeShellArg vision}")
|
||||
(optionalString (trace != null) "--trace ${escapeShellArg trace}")
|
||||
(optionalString (kvDiskDir != null) "--kv-disk-dir ${escapeShellArg kvDiskDir}")
|
||||
(optionalString (kvDiskSpaceMb != null) "--kv-disk-space-mb ${toString kvDiskSpaceMb}")
|
||||
(optionalString (kvCacheMinTokens != null) "--kv-cache-min-tokens ${toString kvCacheMinTokens}")
|
||||
(optionalString (kvCacheColdMaxTokens != null) "--kv-cache-cold-max-tokens ${toString kvCacheColdMaxTokens}")
|
||||
(optionalString (kvCacheContinuedIntervalTokens != null) "--kv-cache-continued-interval-tokens ${toString kvCacheContinuedIntervalTokens}")
|
||||
(optionalString (kvCacheBoundaryTrimTokens != null) "--kv-cache-boundary-trim-tokens ${toString kvCacheBoundaryTrimTokens}")
|
||||
(optionalString (kvCacheBoundaryAlignTokens != null) "--kv-cache-boundary-align-tokens ${toString kvCacheBoundaryAlignTokens}")
|
||||
(optionalString kvCacheRejectDifferentQuant "--kv-cache-reject-different-quant")
|
||||
(optionalString (toolMemoryMaxIds != null) "--tool-memory-max-ids ${toString toolMemoryMaxIds}")
|
||||
(optionalString cors "--cors")
|
||||
(optionalString (gpuDevices != null) "--gpu-devices ${escapeShellArg gpuDevices}")
|
||||
(optionalString ssdStreaming "--ssd-streaming")
|
||||
(optionalString ssdStreamingCold "--ssd-streaming-cold")
|
||||
(optionalString (ssdStreamingCacheExperts != null) "--ssd-streaming-cache-experts ${escapeShellArg ssdStreamingCacheExperts}")
|
||||
(optionalString (ssdStreamingFullLayers != null) "--ssd-streaming-full-layers ${toString ssdStreamingFullLayers}")
|
||||
(optionalString (ssdStreamingPreloadExperts != null) "--ssd-streaming-preload-experts ${toString ssdStreamingPreloadExperts}")
|
||||
]);
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.nixos.server.services.ds4 = {
|
||||
enable = mkEnableOption
|
||||
"ds4-server, the OpenAI/Anthropic/Responses-compatible HTTP API for DwarfStar (DeepSeek V4 Flash/PRO local inference).";
|
||||
|
||||
package = mkPackageOption pkgs "ds4" {
|
||||
default = pkgs.ds4;
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
description = "The user to run ds4-server as.";
|
||||
type = types.str;
|
||||
default = skygUser.name;
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
description = "The group to run ds4-server as.";
|
||||
type = types.str;
|
||||
default = "users";
|
||||
};
|
||||
|
||||
model = mkOption {
|
||||
description = "Path to the GGUF model file (ds4flash.gguf).";
|
||||
type = types.str;
|
||||
example = "/var/lib/ds4/ds4flash.gguf";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
description = "Address the ds4-server HTTP API binds to.";
|
||||
default = "127.0.0.1";
|
||||
example = "0.0.0.0";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
description = "TCP port the ds4-server HTTP API listens on.";
|
||||
default = 8000;
|
||||
type = types.port;
|
||||
};
|
||||
|
||||
ctx = mkOption {
|
||||
description = "Maximum context length (number of tokens).";
|
||||
default = 100000;
|
||||
example = 100000;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
tokens = mkOption {
|
||||
description = "Default max output tokens when clients omit a limit.";
|
||||
default = null;
|
||||
example = 4096;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
threads = mkOption {
|
||||
description = "Number of inference threads (default: CPU core count).";
|
||||
default = null;
|
||||
example = 16;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
power = mkOption {
|
||||
description = "GPU duty-cycle target, 1..100 (default: 100).";
|
||||
default = null;
|
||||
example = 80;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
prefillChunk = mkOption {
|
||||
description = "Graph prefill chunk size in tokens.";
|
||||
default = null;
|
||||
example = 4096;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
batchedSession = mkOption {
|
||||
description = "Keep N resident sessions and batch decode-ready requests.";
|
||||
default = null;
|
||||
example = 4;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
mixedPrefillQuantum = mkOption {
|
||||
description = "Prefill chunk size while generations are active (default: 128; GLM-5.3 minimum: 1024).";
|
||||
default = null;
|
||||
example = 128;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
vision = mkOption {
|
||||
description = "Path to the vision encoder GGUF for the selected model.";
|
||||
default = null;
|
||||
example = "/var/lib/ds4/vision.gguf";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
trace = mkOption {
|
||||
description = "Write prompts, cache decisions, output, and tool calls to this file.";
|
||||
default = null;
|
||||
example = "/var/lib/ds4/trace.log";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
kvDiskDir = mkOption {
|
||||
description = "Directory for KV cache disk offloading (persists across restarts).";
|
||||
default = null;
|
||||
example = "/var/lib/ds4/kv";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
kvDiskSpaceMb = mkOption {
|
||||
description = "Maximum disk space for KV cache offloading in MB.";
|
||||
default = null;
|
||||
example = 8192;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheMinTokens = mkOption {
|
||||
description = "Do not save/load KV checkpoints shorter than this many tokens (default: 512).";
|
||||
default = null;
|
||||
example = 512;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheColdMaxTokens = mkOption {
|
||||
description = "Save cold first prompts up to this many tokens; 0 disables (default: 30000).";
|
||||
default = null;
|
||||
example = 30000;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheContinuedIntervalTokens = mkOption {
|
||||
description = "Save aligned continued frontiers every N tokens; 0 disables (default: 10000).";
|
||||
default = null;
|
||||
example = 10000;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheBoundaryTrimTokens = mkOption {
|
||||
description = "Trim tail tokens for cold boundary saves (default: 32).";
|
||||
default = null;
|
||||
example = 32;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheBoundaryAlignTokens = mkOption {
|
||||
description = "Align cold boundary saves to this multiple (default: 2048).";
|
||||
default = null;
|
||||
example = 2048;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
kvCacheRejectDifferentQuant = mkOption {
|
||||
description = "Reject KV checkpoints written with different routed-expert quantization.";
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
toolMemoryMaxIds = mkOption {
|
||||
description = "Exact tool-call IDs kept in RAM (default: 100000).";
|
||||
default = null;
|
||||
example = 100000;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
cors = mkOption {
|
||||
description = "Enable CORS headers for browser-based clients.";
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
gpuDevices = mkOption {
|
||||
description = "GPU device IDs for multi-GPU inference (e.g. '0,1').";
|
||||
default = null;
|
||||
example = "0,1";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
ssdStreaming = mkOption {
|
||||
description = "Opt in to SSD-backed model streaming instead of full residency (Metal/CUDA/ROCm).";
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
ssdStreamingCacheExperts = mkOption {
|
||||
description = "SSD streaming cache target: N requests dynamic expert slots; NGB also reserves two full prefill layers.";
|
||||
default = null;
|
||||
example = "64";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
ssdStreamingCold = mkOption {
|
||||
description = "SSD streaming: skip the default popularity-based expert-cache preload.";
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
ssdStreamingFullLayers = mkOption {
|
||||
description = "GLM Metal streaming: keep the first N routed layers fully resident (default: auto; 0 disables).";
|
||||
default = null;
|
||||
example = 8;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
ssdStreamingPreloadExperts = mkOption {
|
||||
description = "SSD streaming: upfront popularity preload count (DeepSeek auto-seeds by default; GLM demand-fills unless set).";
|
||||
default = null;
|
||||
example = 128;
|
||||
type = types.nullOr types.int;
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
description = ''
|
||||
Extra environment variables for the ds4-server process. Useful for GPU
|
||||
backends — e.g. ROCm Strix Halo needs HSA_ENABLE_SDMA=0.
|
||||
|
||||
Example for ROCm on Strix Halo:
|
||||
{ HSA_ENABLE_SDMA = "0"; }
|
||||
'';
|
||||
default = { };
|
||||
example = { HSA_ENABLE_SDMA = "0"; };
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
description = "Open the ds4-server port in the firewall.";
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
autoStart = mkOption {
|
||||
description = ''
|
||||
Whether to start ds4-server automatically at boot.
|
||||
Set to false to only start it on demand via `systemctl start ds4-server`.
|
||||
'';
|
||||
default = true;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
extraArgs = mkOption {
|
||||
description = "Additional arguments to append to the ds4-server command line.";
|
||||
default = [ ];
|
||||
example = [ "--no-mmap" "--log-format" "json" ];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
|
||||
extraServiceConfig = mkOption {
|
||||
description = "Extra systemd service unit config (e.g. SupplementaryGroups, TimeoutStopSec).";
|
||||
default = { };
|
||||
example = {
|
||||
SupplementaryGroups = [ "render" "video" ];
|
||||
TimeoutStopSec = 120;
|
||||
};
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.model != "";
|
||||
message = "skyg.nixos.server.services.ds4: `model` must be set to a GGUF file path.";
|
||||
}
|
||||
];
|
||||
|
||||
# Ensure the ds4 package is available in the system closure (for manual use).
|
||||
environment.systemPackages = [ ds4Pkg ];
|
||||
|
||||
systemd.services.ds4-server = {
|
||||
description = "ds4-server — DwarfStar local inference HTTP API (DeepSeek V4 Flash/PRO)";
|
||||
documentation = [
|
||||
"https://github.com/antirez/ds4"
|
||||
"https://github.com/antirez/ds4#readme"
|
||||
];
|
||||
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = lib.optionals cfg.autoStart [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
||||
# Construct the ExecStart as a shell script so we can export env vars
|
||||
# that would otherwise be lost with a raw binary + Environment= (e.g.
|
||||
# ROCM_PATH, HSA_ENABLE_SDMA). Use writeShellScript for a clean script
|
||||
# in the store.
|
||||
ExecStart = pkgs.writeShellScript "ds4-server-start" ''
|
||||
set -eu
|
||||
${concatStringsSep "\n" (mapAttrsToList (name: value: "export ${name}=${escapeShellArg value}") cfg.environment)}
|
||||
exec ${ds4Pkg}/bin/ds4-server ${serverArgs} ${escapeShellArgs cfg.extraArgs}
|
||||
'';
|
||||
|
||||
Restart = "on-failure";
|
||||
RestartSec = 10;
|
||||
StartLimitBurst = 3;
|
||||
|
||||
# Security hardening
|
||||
NoNewPrivileges = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "full";
|
||||
PrivateTmp = true;
|
||||
CapabilityBoundingSet = "";
|
||||
SystemCallFilter = "@system-service @resources";
|
||||
} // cfg.extraServiceConfig;
|
||||
|
||||
# Create directories for KV cache and model storage if configured.
|
||||
};
|
||||
systemd.tmpfiles.rules =
|
||||
(optional (cfg.kvDiskDir != null) "d ${cfg.kvDiskDir} 0700 ${cfg.user} ${cfg.group} - -")
|
||||
++ (optional (cfg.model != "" && hasPrefix "/var/lib/ds4" cfg.model) "d /var/lib/ds4 0700 ${cfg.user} ${cfg.group} - -");
|
||||
|
||||
networking.firewall =
|
||||
mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };
|
||||
};
|
||||
}
|
||||
+19
-7
@@ -5,13 +5,12 @@ Packages here are exposed via an overlay defined in `modules/core/default.nix`.
|
||||
|
||||
## Contents
|
||||
|
||||
| Package | Description |
|
||||
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `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). |
|
||||
| `superset-desktop/` | Superset Desktop (Type-2 AppImage from `superset-sh/superset`). Wrapped with `appimageTools.wrapType2` plus extra FHS libs (`elfutils`, `zstd`, WebKit/tray, GStreamer good/bad) so it runs on NixOS. Exposed as `pkgs.superset-desktop` (`superset-desktop` binary + desktop entry / icons). |
|
||||
| Package | Description |
|
||||
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `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). |
|
||||
| `superset-desktop/` | Superset Desktop (Type-2 AppImage from `superset-sh/superset`). Wrapped with `appimageTools.wrapType2` plus extra FHS libs (`elfutils`, `zstd`, WebKit/tray, GStreamer good/bad) so it runs on NixOS. Exposed as `pkgs.superset-desktop` (`superset-desktop` binary + desktop entry / icons). |
|
||||
|
||||
## Adding a New Package
|
||||
|
||||
@@ -25,6 +24,19 @@ Packages here are exposed via an overlay defined in `modules/core/default.nix`.
|
||||
3. Reference it as `pkgs.<name>` anywhere in the flake
|
||||
4. Optionally expose it as a flake output in `flake.nix` under `packages`
|
||||
|
||||
## Updating Packages
|
||||
|
||||
Each package can have an `update.sh` script that automates version bumps.
|
||||
|
||||
- **`skyg pkgs bump <pkg-name> <version>`** — bump a specific package to a specific version.
|
||||
- **`skyg pkgs update --all`** — auto-detect the latest version for all packages that have `update.sh`.
|
||||
- **`skyg pkgs update <pkg-name>`** — auto-detect the latest version for a single package.
|
||||
|
||||
Each `update.sh` supports two modes:
|
||||
|
||||
- `./update.sh <version>` — bump to the given version.
|
||||
- `./update.sh` (no args) — auto-detect the latest version from upstream.
|
||||
|
||||
## Notes
|
||||
|
||||
- For unfree or binary packages, set `meta.license` and `meta.sourceProvenance` accurately
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
let
|
||||
pname = "buzz-desktop";
|
||||
version = "0.5.24";
|
||||
version = "0.5.25";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/block/buzz/releases/download/desktop-v${version}/Buzz_${version}_amd64.AppImage";
|
||||
hash = "sha256-cD5s/yEvfqu8ZbPLgWxW1lqoWMQ1o94xVP+7MjrJNws=";
|
||||
hash = "sha256-cTYnPVPjqQzwY/PpyDXlU0a+NQLY7StpayPHg5fU8Ek=";
|
||||
};
|
||||
|
||||
extracted = appimageTools.extractType2 {
|
||||
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bump buzz-desktop to a new version.
|
||||
# Usage: ./update.sh [<version>]
|
||||
# With version: bump to that version.
|
||||
# Without args: auto-detect latest from GitHub releases.
|
||||
set -euo pipefail
|
||||
|
||||
PKG="buzz-desktop"
|
||||
REPO="block/buzz"
|
||||
URL_TEMPLATE="https://github.com/block/buzz/releases/download/desktop-v\${VERSION}/Buzz_\${VERSION}_amd64.AppImage"
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
VERSION="$1"
|
||||
else
|
||||
echo "Auto-detecting latest buzz-desktop version..."
|
||||
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases" \
|
||||
| jq -r '[.[] | select(.tag_name | startswith("desktop-v")) | .tag_name | sub("^desktop-v"; "")] | .[0]')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not auto-detect latest version from GitHub."
|
||||
echo "Usage: $0 [<version>]"
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest: $VERSION"
|
||||
fi
|
||||
|
||||
URL=$(eval "echo $URL_TEMPLATE")
|
||||
|
||||
sed -i "s/version = \".*\";/version = \"${VERSION}\";/" default.nix
|
||||
|
||||
HASH=$(nix hash file --type sha256 --sri <(curl -fsSL "$URL"))
|
||||
sed -i "s|hash = \".*\";|hash = \"${HASH}\";|" default.nix
|
||||
|
||||
echo "✅ ${PKG} bumped to ${VERSION}"
|
||||
@@ -1,128 +0,0 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, dpkg
|
||||
, autoPatchelfHook
|
||||
, makeWrapper
|
||||
, alsa-lib
|
||||
, at-spi2-atk
|
||||
, cairo
|
||||
, cups
|
||||
, dbus
|
||||
, expat
|
||||
, gdk-pixbuf
|
||||
, glib
|
||||
, gtk3
|
||||
, libcap_ng
|
||||
, libdrm
|
||||
, libseccomp
|
||||
, libxkbcommon
|
||||
, libx11
|
||||
, libxcomposite
|
||||
, libxdamage
|
||||
, libxext
|
||||
, libxfixes
|
||||
, libxrandr
|
||||
, libxcb
|
||||
, mesa
|
||||
, nspr
|
||||
, nss
|
||||
, pango
|
||||
, systemd
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "claude-desktop";
|
||||
version = "1.22209.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_${finalAttrs.version}_amd64.deb";
|
||||
hash = "sha256:6d18ae792c2bddad01edc97c2c3f4cf489004cefe8fed6760a696ed25c49bf61";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper ];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
at-spi2-atk
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
libcap_ng
|
||||
libdrm
|
||||
libseccomp
|
||||
libxkbcommon
|
||||
libx11
|
||||
libxcomposite
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxrandr
|
||||
libxcb
|
||||
mesa
|
||||
nspr
|
||||
nss
|
||||
pango
|
||||
systemd
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
mkdir -p work
|
||||
cd work
|
||||
ar x $src
|
||||
tar -xf data.tar.xz --no-same-permissions || tar -xf data.tar.xz
|
||||
cd ..
|
||||
mv work/usr .
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r usr/* $out/
|
||||
|
||||
# Move the original binary and create a wrapper
|
||||
mv $out/lib/claude-desktop/claude-desktop $out/lib/claude-desktop/.claude-desktop-wrapped
|
||||
makeWrapper $out/lib/claude-desktop/.claude-desktop-wrapped $out/bin/claude-desktop \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
|
||||
mesa
|
||||
libxkbcommon
|
||||
libx11
|
||||
libxcomposite
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxrandr
|
||||
libxcb
|
||||
glib
|
||||
nspr
|
||||
nss
|
||||
cairo
|
||||
pango
|
||||
gdk-pixbuf
|
||||
at-spi2-atk
|
||||
dbus
|
||||
cups
|
||||
systemd
|
||||
alsa-lib
|
||||
]}"
|
||||
|
||||
# Fix desktop-file Exec/Icon paths if present
|
||||
if [ -d usr/share/applications ]; then
|
||||
substituteInPlace $out/share/applications/*.desktop \
|
||||
--replace-quiet "/usr/bin/claude-desktop" "$out/bin/claude-desktop" || true
|
||||
fi
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Claude Desktop for Linux";
|
||||
homepage = "https://claude.ai/download";
|
||||
license = lib.licenses.unfree;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
mainProgram = "claude-desktop";
|
||||
};
|
||||
})
|
||||
@@ -42,7 +42,7 @@ let
|
||||
# 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).
|
||||
# backend_cuda.cu fails to compile.
|
||||
rocmInputs = lib.optionals (backend == "rocm") [
|
||||
rocmPackages.clr # provides hipcc + HIP runtime
|
||||
rocmPackages.rocm-runtime
|
||||
@@ -77,13 +77,13 @@ let
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "colibri" + lib.optionalString (backend == "rocm") "-rocm";
|
||||
version = "1.5.0";
|
||||
version = "1.12.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "JustVugg";
|
||||
repo = "colibri";
|
||||
rev = "8f512fc8c2f48ffa18cd624cd4a5bcaae4a4abfc"; # tag v1.5.0
|
||||
hash = "sha256-SW5RDghfITxblAI+nZGVCHULrTQxskzdNHguJkSMfN4=";
|
||||
rev = "1c59bff28738f808b130d14758d5a76fc7047e0d"; # tag v1.5.0
|
||||
hash = "sha256-A2+k57KNvTBKWe8Ts1XrQaJn5X7C5G5TLFo+5Uu5Mkk=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bump colibri to a new version.
|
||||
# Usage: ./update.sh [<version>]
|
||||
# With version: bump to that version (e.g. "1.6.0").
|
||||
# Without args: auto-detect latest tag from GitHub.
|
||||
set -euo pipefail
|
||||
|
||||
PKG="colibri"
|
||||
REPO="JustVugg/colibri"
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
VERSION="$1"
|
||||
else
|
||||
echo "Auto-detecting latest colibri version..."
|
||||
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases" \
|
||||
| jq -r '[.[] | select(.tag_name | startswith("v")) | .tag_name | sub("^v"; "")] | .[0]')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not auto-detect latest version from GitHub."
|
||||
echo "Usage: $0 [<version>]"
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest: $VERSION"
|
||||
fi
|
||||
|
||||
# Resolve tag to commit hash
|
||||
REV=$(git ls-remote "https://github.com/${REPO}" "v${VERSION}" | awk '{print $1}')
|
||||
if [ -z "$REV" ]; then
|
||||
echo "Could not find tag v${VERSION} in upstream repo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i "s/version = \".*\";/version = \"${VERSION}\";/" default.nix
|
||||
sed -i "s|rev = \".*\";|rev = \"${REV}\";|" default.nix
|
||||
|
||||
HASH=$(nix hash file --type sha256 --sri <(curl -fsSL "https://github.com/${REPO}/archive/${REV}.tar.gz"))
|
||||
sed -i "s|hash = \".*\";|hash = \"${HASH}\";|" default.nix
|
||||
|
||||
echo "✅ ${PKG} bumped to ${VERSION} (rev ${REV})"
|
||||
@@ -1,199 +0,0 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, curl
|
||||
, cacert
|
||||
, python3
|
||||
, rocmPackages
|
||||
, cudaPackages
|
||||
# backend selects the build target / toolchain.
|
||||
, backend ? "cpu" # one of "cpu" | "rocm" | "cuda"
|
||||
# CUDA: null => `cuda-generic` (CUDA_ARCH=native, build host == GPU host);
|
||||
# set e.g. "sm_89" to pin an arch via `make cuda CUDA_ARCH=sm_89`.
|
||||
, cudaArch ? null
|
||||
# ROCm: GPU target. gfx1151 == AMD Strix Halo (the upstream default).
|
||||
, rocmArch ? "gfx1151"
|
||||
}:
|
||||
|
||||
# DwarfStar (antirez/ds4) — a from-source DeepSeek V4 Flash/PRO local inference
|
||||
# engine. Upstream is a hand-written Makefile with no `install` target and no
|
||||
# tagged releases, so we pin a `main` commit and write our own installPhase.
|
||||
#
|
||||
# This derivation is *backend-parameterized*: pick the GPU backend with the
|
||||
# `backend` argument ("cpu" | "rocm" | "cuda"). The overlay in
|
||||
# modules/core/default.nix wires up `ds4` (cpu), `ds4-rocm`, and `ds4-cuda`.
|
||||
#
|
||||
# Build-per-host: we keep upstream's `-march=native` default (NATIVE_CPU_FLAG),
|
||||
# so the resulting store paths are CPU-specific and are NOT safe to share across
|
||||
# heterogeneous machines. Build each variant on (or for) its target host. The
|
||||
# GPU variants must be built on a machine carrying the matching toolchain.
|
||||
#
|
||||
# To bump: set `rev` to the new `main` HEAD and refresh `hash` (start from
|
||||
# lib.fakeHash and copy the SRI hash from the build error, or use
|
||||
# `nix-prefetch-url --unpack https://github.com/antirez/ds4/archive/<rev>.tar.gz`
|
||||
# then `nix hash to-sri --type sha256 <hash>`).
|
||||
|
||||
assert lib.elem backend [ "cpu" "rocm" "cuda" ];
|
||||
|
||||
let
|
||||
# `hf` CLI used by ds4-download-model for the large/sharded GGUF files
|
||||
# (MXFP4, PRO, GLM). huggingface-hub provides the `hf` binary; hf-xet is the
|
||||
# optional Xet backend it uses to speed up big transfers. Default python3 is
|
||||
# 3.14, so this resolves to python314Packages.{huggingface-hub,hf-xet}.
|
||||
pythonEnv = python3.withPackages (
|
||||
ps: with ps; [
|
||||
huggingface-hub
|
||||
hf-xet
|
||||
]
|
||||
);
|
||||
|
||||
# ROCm libraries the gfx kernels and link flags (-lhipblas -lhipblaslt) need.
|
||||
rocmInputs = [
|
||||
rocmPackages.clr # provides hipcc + HIP runtime
|
||||
rocmPackages.hipblas
|
||||
rocmPackages.hipblas-common # hipblas.h includes hipblas-common/hipblas-common.h
|
||||
rocmPackages.hipblaslt
|
||||
rocmPackages.rocblas
|
||||
rocmPackages.rocwmma # gfx1151 backend uses rocWMMA headers
|
||||
rocmPackages.hipcub
|
||||
rocmPackages.rocprim
|
||||
rocmPackages.rocthrust
|
||||
rocmPackages.rocm-runtime
|
||||
];
|
||||
|
||||
# -L<dir> and matching rpath so the linked binaries resolve the ROCm .so's
|
||||
# from the store at runtime (upstream assumes /opt/rocm on PATH).
|
||||
rocmLibDirs = map (p: "${lib.getLib p}/lib") rocmInputs;
|
||||
rocmLinkFlags =
|
||||
lib.concatStringsSep " "
|
||||
(map (d: "-L${d} -Wl,-rpath,${d}") rocmLibDirs);
|
||||
rocmIncludeFlags =
|
||||
lib.concatStringsSep " "
|
||||
(map (p: "-I${lib.getDev p}/include") rocmInputs);
|
||||
|
||||
# CUDA libs we link against; nvcc is the linker for the cuda build.
|
||||
cudaLibDirs = [
|
||||
"${lib.getLib cudaPackages.cuda_cudart}/lib"
|
||||
"${lib.getLib cudaPackages.libcublas}/lib"
|
||||
];
|
||||
cudaLinkFlags =
|
||||
lib.concatStringsSep " "
|
||||
(map (d: "-L${d} -Xlinker -rpath -Xlinker ${d}") cudaLibDirs);
|
||||
|
||||
# phony Makefile target per backend.
|
||||
buildTarget = {
|
||||
cpu = "cpu";
|
||||
rocm = "strix-halo";
|
||||
cuda = if cudaArch == null then "cuda-generic" else "cuda";
|
||||
}.${backend};
|
||||
|
||||
# Per-backend command-line variable overrides (forwarded to the recursive
|
||||
# sub-make as MAKEOVERRIDES, beating the Makefile's `?=` defaults).
|
||||
#
|
||||
# `makeFlags` entries are expanded UNQUOTED by the generic builder, so any
|
||||
# value containing spaces (CFLAGS/LDLIBS) would be word-split and make would
|
||||
# treat the extra words as bogus options. Those go through `makeFlagsArray`
|
||||
# (a quoted bash array, set in preBuild) instead; only space-free assignments
|
||||
# may live in `makeFlags`.
|
||||
backendMakeFlags = {
|
||||
cpu = [ ];
|
||||
rocm = [ "ROCM_ARCH=${rocmArch}" ];
|
||||
cuda = [
|
||||
"NVCC=${lib.getExe' cudaPackages.cuda_nvcc "nvcc"}"
|
||||
"CUDA_HOME=${cudaPackages.cuda_nvcc}"
|
||||
] ++ lib.optional (cudaArch != null) "CUDA_ARCH=${cudaArch}";
|
||||
}.${backend};
|
||||
|
||||
# Space-containing variable assignments (must survive word splitting).
|
||||
backendMakeFlagsArray = {
|
||||
cpu = [ ];
|
||||
rocm = [
|
||||
# Append store include/lib paths to the upstream ROCm flags (hipcc is the
|
||||
# raw ROCm compiler, not the nix cc-wrapper, so it needs explicit -I/-L).
|
||||
"ROCM_CFLAGS=-O3 -ffast-math -g -fno-finite-math-only -pthread -D__HIP_PLATFORM_AMD__ -Wno-unused-command-line-argument --offload-arch=${rocmArch} ${rocmIncludeFlags}"
|
||||
"ROCM_LDLIBS=-lm -pthread ${rocmLinkFlags} -lhipblas -lhipblaslt -lrocblas"
|
||||
];
|
||||
cuda = [
|
||||
# Replace upstream's hardcoded /usr/local/cuda + sbsa-linux (aarch64)
|
||||
# paths with the nixpkgs cudart/cublas store paths.
|
||||
"CUDA_LDLIBS=-lm -Xcompiler -pthread ${cudaLinkFlags} -lcudart -lcublas"
|
||||
];
|
||||
}.${backend};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ds4" + lib.optionalString (backend != "cpu") "-${backend}";
|
||||
version = "0-unstable-2026-09-16";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "antirez";
|
||||
repo = "ds4";
|
||||
rev = "8db1d1d155cb0400a86a86b9c62d0defb3a6148b";
|
||||
hash = "sha256-d0TRJH5/cNlDrgJy2i9eEUuSAlnka0BvxDXlXIwMwrE=";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
nativeBuildInputs =
|
||||
[ makeWrapper ]
|
||||
++ lib.optionals (backend == "rocm") [ rocmPackages.clr ]
|
||||
++ lib.optionals (backend == "cuda") [ cudaPackages.cuda_nvcc ];
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (backend == "rocm") rocmInputs
|
||||
++ lib.optionals (backend == "cuda") [
|
||||
cudaPackages.cuda_cudart
|
||||
cudaPackages.libcublas
|
||||
];
|
||||
|
||||
makeFlags = backendMakeFlags;
|
||||
buildFlags = [ buildTarget ];
|
||||
|
||||
# Pass space-containing make variables as a quoted array so they aren't
|
||||
# word-split (see backendMakeFlagsArray note above).
|
||||
preBuild = lib.optionalString (backendMakeFlagsArray != [ ]) ''
|
||||
makeFlagsArray+=(${lib.escapeShellArgs backendMakeFlagsArray})
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 -t "$out/bin" ds4 ds4-server ds4-bench ds4-eval ds4-agent
|
||||
|
||||
# Wire upstream's GGUF downloader in as `ds4-download-model`. Patch its
|
||||
# project-root detection so the gguf dir and the `ds4flash.gguf` symlink
|
||||
# land in a writable location ($DS4_HOME, default: cwd) instead of the
|
||||
# read-only store dir that `dirname $0` would resolve to here.
|
||||
install -Dm755 download_model.sh "$out/bin/ds4-download-model"
|
||||
substituteInPlace "$out/bin/ds4-download-model" \
|
||||
--replace-fail 'ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)' 'ROOT=''${DS4_HOME:-$PWD}' \
|
||||
--replace-warn './download_model.sh' 'ds4-download-model'
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# `ds4-download-model` shells out to curl (and optionally the `hf` CLI for the
|
||||
# huge PRO files); make curl available and point it at a CA bundle if the
|
||||
# environment doesn't already set one.
|
||||
postFixup = ''
|
||||
wrapProgram "$out/bin/ds4-download-model" \
|
||||
--prefix PATH : ${lib.makeBinPath [ curl pythonEnv ]} \
|
||||
--set-default SSL_CERT_FILE ${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
'';
|
||||
|
||||
# Only the CPU variant is guaranteed to run without a GPU/device present, so
|
||||
# restrict the smoke check to it. GPU variants are validated on real hardware.
|
||||
doInstallCheck = backend == "cpu";
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
"$out/bin/ds4" --help >/dev/null
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "DeepSeek V4 Flash/PRO local inference engine (DwarfStar)";
|
||||
homepage = "https://github.com/antirez/ds4";
|
||||
license = lib.licenses.mit;
|
||||
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
||||
platforms = lib.platforms.linux; # Metal backend is macOS-only, out of scope
|
||||
mainProgram = "ds4";
|
||||
};
|
||||
})
|
||||
@@ -1,102 +0,0 @@
|
||||
# ds4 (DwarfStar) — user guide
|
||||
|
||||
A from-source build of [`antirez/ds4`](https://github.com/antirez/ds4), a local
|
||||
inference engine for **DeepSeek V4 Flash/PRO**. This is a short operational
|
||||
guide; see the [upstream README](https://github.com/antirez/ds4) for the full
|
||||
documentation (server API, agent, distributed inference, tuning, etc.).
|
||||
|
||||
## What's installed
|
||||
|
||||
The package builds for a chosen GPU backend (`cpu`, `rocm`, or `cuda`) and
|
||||
installs these binaries:
|
||||
|
||||
| Binary | What it does |
|
||||
|---|---|
|
||||
| `ds4` | Interactive CLI chat / one-shot `-p "..."` |
|
||||
| `ds4-server` | OpenAI/Anthropic/Responses-compatible HTTP API |
|
||||
| `ds4-agent` | Native terminal coding agent (alpha) |
|
||||
| `ds4-bench` | Throughput benchmarking |
|
||||
| `ds4-eval` | Capability/regression eval harness |
|
||||
| `ds4-download-model` | Helper to fetch GGUF weights (see below) |
|
||||
|
||||
There is **no graphical UI**. `ds4-server` exposes a URL you can point an
|
||||
OpenAI-compatible client at.
|
||||
|
||||
## 1. Get the weights
|
||||
|
||||
Weights are **not** packaged. They live at the project's Hugging Face repos
|
||||
([`antirez/deepseek-v4-gguf`](https://huggingface.co/antirez/deepseek-v4-gguf)
|
||||
for DeepSeek V4, [`antirez/GLM-5.2-GGUF`](https://huggingface.co/antirez/GLM-5.2-GGUF)
|
||||
and [`unsloth/GLM-5.2-GGUF`](https://huggingface.co/unsloth/GLM-5.2-GGUF) for
|
||||
GLM 5.2) — public, MIT, no token needed — and only these custom GGUFs work, not
|
||||
arbitrary DeepSeek/GLM GGUFs.
|
||||
|
||||
`ds4-download-model` writes into `./gguf` and links `./ds4flash.gguf` in the
|
||||
current directory (override the root with `DS4_HOME`, or the gguf dir with
|
||||
`DS4_GGUF_DIR`):
|
||||
|
||||
```sh
|
||||
# DeepSeek V4 Flash (0731 checkpoints)
|
||||
ds4-download-model ds4f-q2 # ~81 GB, the pick for 96/128 GB machines
|
||||
ds4-download-model ds4f-q2-q4 # ~98 GB, last 6 expert layers at q4
|
||||
ds4-download-model ds4f-q4 # ~153 GB, for >=256 GB machines
|
||||
ds4-download-model ds4f-mxfp4 # ~156 GB, native MXFP4 (Metal/CUDA)
|
||||
ds4-download-model ds4f-dspark # ~6 GB, optional DSpark speculative draft
|
||||
|
||||
# DeepSeek V4 PRO (512 GB / distributed)
|
||||
ds4-download-model pro-q2-imatrix # single-file PRO q2
|
||||
ds4-download-model pro-q4-split # both halves of PRO Q4 split
|
||||
|
||||
# GLM 5.2
|
||||
ds4-download-model glm-unsloth-q4 # Unsloth UD-Q4_K_XL, 11 shards
|
||||
ds4-download-model glm-antirez-iq2xxs # routed IQ2_XXS, reduced-memory
|
||||
ds4-download-model glm-antirez-q2 # routed Q2_K, ~262 GB
|
||||
ds4-download-model glm-antirez-q4 # routed Q4_K, ~434 GB
|
||||
|
||||
ds4-download-model --help # full target list
|
||||
```
|
||||
|
||||
Pick by machine memory: `ds4f-q2` (96/128 GB), `ds4f-q4` (>=256 GB),
|
||||
`pro-*` (512 GB / distributed), `glm-*` (per-target sizes above). The small
|
||||
Flash quants download via `curl`; the MXFP4, PRO, and GLM files use the `hf`
|
||||
CLI (bundled in the package via `huggingface-hub` + `hf-xet`), which
|
||||
`ds4-download-model` puts on its PATH automatically.
|
||||
|
||||
## 2. Run it
|
||||
|
||||
```sh
|
||||
# interactive chat (defaults to ./ds4flash.gguf in the current dir)
|
||||
ds4
|
||||
|
||||
# explicit model path
|
||||
ds4 -m /path/to/gguf/DeepSeek-V4-Flash-IQ2XXS-...-imatrix-0731.gguf
|
||||
|
||||
# DSpark speculative decoding (greedy only; needs the ds4f-dspark support GGUF)
|
||||
ds4 -m ./ds4flash.gguf \
|
||||
--dspark --mtp ./gguf/DeepSeek-V4-Flash-DSpark-support-0731.gguf --temp 0
|
||||
|
||||
# GLM 5.2 (experimental greedy MTP via --glm-mtp)
|
||||
ds4 -m gguf/GLM-5.2-UD-IQ2_XXS_RoutedIQ2XXS_blk78Q2K.gguf --glm-mtp-timing --temp 0
|
||||
|
||||
# HTTP server on the LAN
|
||||
ds4-server -m ./ds4flash.gguf \
|
||||
--ctx 100000 --kv-disk-dir ./kv --kv-disk-space-mb 8192 --host 0.0.0.0
|
||||
```
|
||||
|
||||
Then point a client at `http://<host>:8000/v1` (endpoints: `/v1/chat/completions`,
|
||||
`/v1/messages`, `/v1/responses`, ...). Use `--cors` for browser clients.
|
||||
|
||||
## Backend notes
|
||||
|
||||
- **rocm** targets a specific GPU arch (default `gfx1151`, AMD Strix Halo). At
|
||||
runtime the user needs `/dev/kfd` + render-node access, and large models need
|
||||
the GTT memory kernel params from upstream's `STRIXHALO.md`. On Strix Halo,
|
||||
export `HSA_ENABLE_SDMA=0` (SDMA is buggy on its unified memory).
|
||||
- **cuda** is unfree (CUDA closure) and needs an NVIDIA driver at runtime.
|
||||
- **cpu** is a reference/debug path only — not for production inference.
|
||||
|
||||
## Maintenance
|
||||
|
||||
This tracks upstream `main` (no releases). To bump, set `rev` in `default.nix`
|
||||
and refresh `hash`. Binaries are built per-host (`-march=native`), so build each
|
||||
GPU variant on its target host. See `default.nix`'s header comment for details.
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bump superset-desktop to a new version.
|
||||
# Usage: ./update.sh [<version>]
|
||||
# With version: bump to that version.
|
||||
# Without args: auto-detect latest from GitHub releases.
|
||||
set -euo pipefail
|
||||
|
||||
PKG="superset-desktop"
|
||||
REPO="superset-sh/superset"
|
||||
URL_TEMPLATE="https://github.com/superset-sh/superset/releases/download/desktop-v\${VERSION}/superset-\${VERSION}-x86_64.AppImage"
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
VERSION="$1"
|
||||
else
|
||||
echo "Auto-detecting latest superset-desktop version..."
|
||||
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases" \
|
||||
| jq -r '[.[] | select(.tag_name | startswith("desktop-v")) | .tag_name | sub("^desktop-v"; "")] | .[0]')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not auto-detect latest version from GitHub."
|
||||
echo "Usage: $0 [<version>]"
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest: $VERSION"
|
||||
fi
|
||||
|
||||
URL=$(eval "echo $URL_TEMPLATE")
|
||||
|
||||
sed -i "s/version = \".*\";/version = \"${VERSION}\";/" default.nix
|
||||
|
||||
HASH=$(nix hash file --type sha256 --sri <(curl -fsSL "$URL"))
|
||||
sed -i "s|hash = \".*\";|hash = \"${HASH}\";|" default.nix
|
||||
|
||||
echo "✅ ${PKG} bumped to ${VERSION}"
|
||||
Reference in new issue
Block a user