cleaning up old bots

This commit is contained in:
ari committed 2026-11-05 15:21:01 -05:00
1 parent 880c85facb
commit e3f01e3c35
25 files changed
+12 -1267

No files matched your search

+2 -2
View File
@@ -31,8 +31,8 @@ hosts/
| Folder | Host | Role |
| ------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `fwbook/` | fwbook | Framework 13 AMD — personal laptop / daily driver |
| `hl-fwdesk/` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation; buildbot-nix CI worker (4 cores); nbot master (slackerbot off) |
| `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node; nbot worker (slackerbot off) |
| `hl-fwdesk/` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation; buildbot-nix CI worker (4 cores); nbot master |
| `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node; nbot worker |
| `hl-bigbox1/` | hl-bigbox1 | AI/compute server (NVIDIA + AMD); Immich machine-learning (CUDA) |
| `hl-bigbox2/` | hl-bigbox2 | NFS storage server; Immich server/db (docker, `immich.home.sosnovsky.ca`) |
| `hl-minipc1/` | hl-minipc1 | Core infra: Gitea (native or containerized), nix-serve, registry, Buzz (docker, `buzz-manage` CLI), monitoring (Grafana, Prometheus, Loki, OTel collector) |
-2
View File
@@ -8,8 +8,6 @@
./steam.nix
./buildbot.nix
./linux-tracker.nix
./robotnix.nix
./slackerbot.nix
./nbot.nix
];
}
-1
View File
@@ -28,7 +28,6 @@ let
OPENROUTER_API_KEY = "$OPENROUTER_API_KEY";
CLAUDE_CODE_OAUTH_TOKEN = "$CLAUDE_CODE_OAUTH_TOKEN";
COMMAND_CODE_API_KEY = "$COMMAND_CODE_API_KEY";
# Every agent can use this PAT, so anyone who can prompt one can too.
GH_TOKEN = "$GH_TOKEN";
};
-124
View File
@@ -1,124 +0,0 @@
{ config, lib, skyg-secrets, ... }:
let
apps = config.skyg.internalNetworkingMap.apps;
robotSecrets = [ "robots-shared" "robots-sibli" "robots-genix" ];
secret = name: config.age.secrets.${name}.path;
ports = {
ollama = 11434;
ds4 = 8000;
tracker = 1984;
};
# A robot's seed: its config plus the files it shares with the others.
# Each robot gets copies under /etc/nixos/seed (same layout as this repo),
# so a robot that rebuilds itself (genix) keeps working.
seedOf = file: {
root = ../../..;
configuration = file;
extraFiles = [
./robotnix/common.nix
./robotnix/buzz.nix
../../../pkgs/buzz-cli
];
};
in
{
age.secrets = lib.genAttrs robotSecrets (name: {
file = skyg-secrets.${name};
owner = "root";
mode = "0400";
});
# robotnix flake input; options and docs in its repo.
services.robotnix = {
enable = true;
externalInterface = "enp191s0";
# Every robot gets this tier. Same holes as the Hermes VM.
access.shared = {
internet = "all";
hostAccess = [
{ port = ports.ollama; }
];
lanAccess = [
{ address = "10.0.101.3"; port = 443; }
{ address = "10.0.101.3"; port = 3000; }
{ address = "10.0.101.3"; port = 8080; }
{ address = "10.0.101.3"; port = 9102; }
];
};
# A Hermes agent in every robot.
hermes = {
enable = true;
environmentFiles = [ (secret "robots-shared") ];
};
robots.sibli = {
id = 2;
address = apps.sibli.ip;
cpus = { min = 1; max = 4; };
memory = { min = "2G"; max = "16G"; };
disk = { rootSize = "100G"; homeSize = "60G"; };
seed = seedOf ./robotnix/sibli.nix;
hermes = {
name = "Siblix";
environmentFiles = [ (secret "robots-sibli") ];
settings.model = {
provider = "anthropic";
default = "claude-haiku-5-5";
};
};
allowDocker = true;
allowTun = true;
ephemeral = true;
persist = [
"/var/lib/tailscale"
"/var/lib/docker"
];
access = { };
git.enable = false;
};
# Persistent and self-managing: genix changes and applies its own system
# (robotnix-apply), pushes its flake to gitea, and pulls it back after a
# reseed. Add /var/lib/robotnix-git/id_ed25519.pub (inside genix) as a
# deploy key with write access on ari/genix.
robots.genix = {
id = 3;
address = apps.genix.ip;
cpus = { min = 1; max = 6; };
memory = { min = "4G"; max = "24G"; };
disk = { rootSize = "150G"; homeSize = "100G"; };
seed = seedOf ./robotnix/genix.nix;
selfManage.enable = true;
git = {
remoteUrl = "gitea@gitea.app.internal:Hermenix/genix.git";
interval = "hourly";
};
hermes = {
name = "Genix";
environmentFiles = [ (secret "robots-genix") ];
settings = {
model = {
provider = "commandcode";
default = "deepseek/deepseek-v4.1-flash";
};
fallback_providers = [
{ provider = "anthropic"; model = "claude-haiku-5-5"; }
{ provider = "openrouter"; model = "deepseek/deepseek-v4.1-flash"; }
];
};
};
allowDocker = true;
# Survive a reseed (root is rebuilt from the git remote).
persist = [
"/var/lib/hermes"
"/var/lib/docker"
];
# Push/pull its flake over gitea's ssh.
access.lanAccess = [
{ address = apps.gitea.ip; port = 22; }
];
};
};
}
@@ -1,77 +0,0 @@
# Buzz for a robot's Hermes: the `buzz` CLI and a profile for its key.
# Shared by this host's robots (copied into each under /etc/nixos/seed).
# Needs a Buzz identity in the robot's secret: `skyg buzz identity <robot>`.
{ config, lib, pkgs, ... }:
let
cfg = config.skyg.robot.buzz;
# Built from this repo; the robot gets a copy of pkgs/buzz-cli with this file.
buzz-cli = pkgs.callPackage ../../../../pkgs/buzz-cli { };
in
{
options.skyg.robot.buzz = {
enable = lib.mkEnableOption "Buzz for this robot's Hermes";
homeChannel = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "BUZZ_HOME_CHANNEL (not secret, so it lives here, not in the secret).";
};
profileName = lib.mkOption {
type = lib.types.str;
default = config.services.hermes-agent.environment.API_SERVER_MODEL_NAME or config.networking.hostName;
defaultText = lib.literalExpression "the Hermes gateway model name, else the host name";
description = "Name published for a new key that has no Buzz profile yet.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ buzz-cli ];
# The Hermes service PATH has no system packages.
services.hermes-agent.environment = {
BUZZ_CLI_PATH = "${buzz-cli}/bin/buzz";
} // lib.optionalAttrs (cfg.homeChannel != null) {
BUZZ_HOME_CHANNEL = cfg.homeChannel;
};
# A new Buzz key has no profile, and Hermes won't connect without one.
# Publish one at start if missing; the relay keeps it.
systemd.services.buzz-profile = {
description = "Publish the Buzz profile if missing";
wantedBy = [ "multi-user.target" ];
before = [ "hermes-agent.service" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = [ buzz-cli pkgs.jq ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
User = "hermes";
EnvironmentFile = config.systemd.services.hermes-agent.serviceConfig.EnvironmentFile;
};
script = ''
if [ -z "''${BUZZ_PRIVATE_KEY:-}" ] || [ -z "''${BUZZ_RELAY_URL:-}" ]; then
echo "No Buzz creds, skipping."
exit 0
fi
# Retry: the relay may not be reachable yet. Failure is not fatal.
for _ in 1 2 3 4 5; do
n=""
if out=$(buzz users get); then
n=$(jq 'length' <<<"$out") || n=""
fi
if [ "$n" = "0" ]; then
if buzz users set-profile --name ${lib.escapeShellArg cfg.profileName}; then
echo "Published Buzz profile."
exit 0
fi
elif [ -n "$n" ]; then
echo "Buzz profile exists."
exit 0
fi
sleep 5
done
echo "Could not check or publish the Buzz profile." >&2
'';
};
};
}
@@ -1,45 +0,0 @@
# Shared base for this host's robots (sibli, genix). Robots get a copy under
# /etc/nixos/seed (see seedOf in ../robotnix.nix), so a robot that rebuilds
# itself keeps working; edit it here for new installs and ephemeral robots.
{ config, lib, pkgs, ... }:
let
user = config.robotnix.user;
in
{
# The user has no password; ssh keys only.
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [
git
vim
curl
htop
claude-code
devenv
direnv
(python3.withPackages (ps: [ ps.pip ]))
nodejs
docker-compose
zellij
];
nixpkgs.config.allowUnfree = true;
# direnv: hook into bash so the repo's devenv shims work.
programs.bash = {
enable = true;
interactiveShellInit = ''
eval "$(direnv hook bash)"
'';
};
# Docker + compose. Needs allowDocker = true on the host.
virtualisation.docker.enable = true;
users.users.${user}.extraGroups = [ "docker" ];
users.users.hermes.extraGroups = lib.mkIf config.robotnix.hermes.enable [ "docker" ];
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
}
@@ -1,13 +0,0 @@
# genix's starting config. It is persistent and manages itself: after the
# first install this (copied to /etc/nixos/seed/...) belongs to genix, which
# changes and applies its own system with robotnix-apply. Edits here only
# matter for a fresh install with nothing on its git remote.
{ ... }:
{
imports = [
./common.nix
./buzz.nix
];
skyg.robot.buzz.enable = true;
}
@@ -1,71 +0,0 @@
# sibli is ephemeral: root resets to this config on every start, so change
# things here (then rebuild the host), not inside the robot.
{ config, pkgs, ... }:
let
robotoName = config.services.hermes-agent.environment.API_SERVER_MODEL_NAME;
in
{
imports = [
./common.nix
./buzz.nix
];
skyg.robot.buzz = {
enable = true;
homeChannel = "a8969cdc-7ba2-4e25-ae18-b898ab59003d";
};
services.hermes-agent = {
extraPackages = [ pkgs.nodejs ];
mcpServers.shortcut = {
command = "${pkgs.nodejs}/bin/npx";
args = [ "-y" "@shortcut/mcp@latest" ];
env.SHORTCUT_API_TOKEN = "\${SHORTCUT_API_KEY}";
};
};
services.tailscale.enable = true;
services.tailscale.openFirewall = true;
networking.firewall.trustedInterfaces = [ "tailscale0" ];
systemd.services.tailscale-login = {
description = "Log in to Tailscale if needed";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" "tailscaled.service" ];
requires = [ "tailscaled.service" ];
path = [ config.services.tailscale.package pkgs.jq ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
EnvironmentFile = config.systemd.services.hermes-agent.serviceConfig.EnvironmentFile;
};
script = ''
if [ -z "''${TS_AUTHKEY:-}" ]; then
echo "No TS_AUTHKEY, skipping."
exit 0
fi
# Retry: the daemon may not be ready yet. Failure is not fatal.
for _ in 1 2 3 4 5 6; do
state=""
if out=$(tailscale status --json); then
state=$(jq -r '.BackendState' <<<"$out") || state=""
fi
case "$state" in
Running)
echo "Already logged in."
exit 0
;;
NeedsLogin|Stopped)
if tailscale up --auth-key="$TS_AUTHKEY" --hostname=ari-fwdesk-${robotoName}-bot; then
echo "Logged in."
exit 0
fi
;;
esac
sleep 5
done
echo "Could not log in to Tailscale." >&2
'';
};
}
-83
View File
@@ -1,83 +0,0 @@
{ config, lib, pkgs, skyg-secrets, ... }:
let
ports = { cluster = 7946; };
homes = "/data/slackerbot";
secrets = [ "slackerbot-slack" "slackerbot-goose" "slackerbot-cluster" ];
bazel = config.skyg.nixos.server.services.bazel-build;
settings = {
# The system each container boots (slackerbot's agent + bazel/rbuild);
# updated on every rebuild.
system = "${bazel.agentSystem}";
# Shared Bazel download cache (/repo-cache) for the containers.
rw_binds = bazel.binds.rw;
ro_binds = bazel.binds.ro;
machines_dir = "/var/lib/machines";
state_dir = "/var/lib/slackerbot";
agent_cwd = "/root";
idle_timeout = "6h";
max_idle_timeout = "0s";
allow_indefinite = true;
boot_timeout = "2m";
# Goose settings sent to every container (also on fws1).
# Values come from the slackerbot-goose secret.
agent_env = {
GOOSE_PROVIDER = "$GOOSE_PROVIDER";
GOOSE_MODEL = "$GOOSE_MODEL";
OPENROUTER_API_KEY = "$OPENROUTER_API_KEY";
};
container = { memory_mb = 4096; cpus = 1.0; };
max_container = { memory_mb = 8192; cpus = 2.0; };
# Leave room for ollama, ds4, comfyui, hermes and the robots.
host_reserve = { memory_mb = 32768; cpus = 4.0; };
storage = { min = "2G"; max = "5G"; limit = "20G"; };
drives = [{ path = homes; reserve = "40G"; }];
cluster = {
secret = "$CLUSTER_SECRET";
listen = ":${toString ports.cluster}";
};
# Only read on first start; after that, manage permissions from Slack.
permissions = {
managers = [ "U0CDGSJADMM" ];
default.U0CDGSJADMM = [ "all" ];
};
};
in
{
# Off.
config = lib.mkIf false {
age.secrets = lib.genAttrs secrets (name: {
file = skyg-secrets.${name};
owner = "root";
mode = "0400";
});
# slackerbot flake input; options and docs in its repo.
services.slackerbot = {
enable = true;
mode = "master";
clusterPort = ports.cluster;
configFile = (pkgs.formats.toml { }).generate "slackerbot.toml" settings;
};
# Bazel build server for the containers (16 cores / 32 threads).
skyg.nixos.server.services.bazel-build = {
enable = true;
cpuCount = 32;
cacheGB = 200;
};
# The module takes one env file; these add to it.
systemd.services.slackerbot.serviceConfig.EnvironmentFile =
map (name: config.age.secrets.${name}.path) secrets;
# Container links belong to systemd-networkd.
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
networking.dhcpcd.denyInterfaces = [ "ve-*" ];
systemd.tmpfiles.rules = [ "d ${homes} 0700 root root -" ];
};
}
+1 -1
View File
@@ -1,6 +1,6 @@
{ ... }:
{
imports = [ ./slackerbot.nix ./nbot.nix ];
imports = [ ./nbot.nix ];
services.pipewire = {
extraConfig.pipewire-pulse."10-raop-discover" = {
+2 -2
View File
@@ -16,8 +16,8 @@ let
container = { memory_mb = 4096; cpus = 1.0; };
max_container = { memory_mb = 51200; cpus = 6; };
host_reserve = { memory_mb = 8192; cpus = 2.0; };
storage = { min = "2G"; max = "5G"; limit = "20G"; };
drives = [{ path = homes; reserve = "100G"; }];
storage = { min = "2G"; max = "10G"; limit = "50G"; };
drives = [{ path = homes; reserve = "200G"; }];
# Worker of the master on fwdesk. Slack tokens and goose settings come
# from the master. Trusts the first certificate it sees (saved in
-69
View File
@@ -1,69 +0,0 @@
{ config, lib, pkgs, skyg-secrets, ... }:
let
homes = "/var/lib/slackerbot/homes";
bazel = config.skyg.nixos.server.services.bazel-build;
settings = {
# The system each container boots (slackerbot's agent + bazel/rbuild);
# updated on every rebuild.
system = "${bazel.agentSystem}";
# Shared Bazel download cache (/repo-cache) for the containers.
rw_binds = bazel.binds.rw;
ro_binds = bazel.binds.ro;
machines_dir = "/var/lib/machines";
state_dir = "/var/lib/slackerbot";
agent_cwd = "/root";
idle_timeout = "6h";
max_idle_timeout = "0s";
allow_indefinite = true;
boot_timeout = "2m";
container = { memory_mb = 4096; cpus = 1.0; };
max_container = { memory_mb = 8192; cpus = 2.0; };
host_reserve = { memory_mb = 8192; cpus = 2.0; };
storage = { min = "2G"; max = "5G"; limit = "20G"; };
drives = [{ path = homes; reserve = "100G"; }];
# Worker of the master on fwdesk. Slack tokens and goose settings come
# from the master. Trusts the first certificate it sees (saved in
# state_dir/master.fingerprint); pin it in master_fingerprint if wanted.
cluster = {
secret = "$CLUSTER_SECRET";
master = "wss://fwdesk.lab.internal:7946";
};
};
in
{
# Off.
config = lib.mkIf false {
age.secrets.slackerbot-cluster = {
file = skyg-secrets.slackerbot-cluster;
owner = "root";
mode = "0400";
};
# slackerbot flake input; options and docs in its repo.
services.slackerbot = {
enable = true;
mode = "slave";
configFile = (pkgs.formats.toml { }).generate "slackerbot.toml" settings;
environmentFile = config.age.secrets.slackerbot-cluster.path;
};
# Bazel build server for the containers (4 cores / 8 threads).
skyg.nixos.server.services.bazel-build = {
enable = true;
cpuCount = 8;
cacheGB = 50;
};
# Container links belong to systemd-networkd.
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
networking.dhcpcd.denyInterfaces = [ "ve-*" ];
# networkd only has the container links here (NetworkManager owns wlan),
# so wait-online would always time out.
systemd.network.wait-online.enable = false;
systemd.tmpfiles.rules = [ "d ${homes} 0700 root root -" ];
};
}