nbots
This commit is contained in:
1 parent
8fec1dd4bb
commit
2b83e9c606
15 files changed
+218
-60
No files matched your search
+2
-2
@@ -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); slackerbot master |
|
||||
| `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node; slackerbot worker |
|
||||
| `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-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) |
|
||||
|
||||
@@ -13,6 +13,7 @@ in
|
||||
};
|
||||
networking.firewall.allowedUDPPorts = openPorts;
|
||||
networking.firewall.allowedTCPPorts = openPorts;
|
||||
programs.mosh.enable = true;
|
||||
networking.hosts = {
|
||||
"0.0.0.0" = [
|
||||
"auth.me.internal"
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
./linux-tracker.nix
|
||||
./robotnix.nix
|
||||
./slackerbot.nix
|
||||
./nbot.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
{ config, lib, pkgs, nbot, skyg-secrets, ... }:
|
||||
let
|
||||
ports = { cluster = 7946; };
|
||||
homes = "/data/nbot";
|
||||
secrets = [ "nbot-slack" "nbot-goose" "nbot-cluster" ];
|
||||
settings = {
|
||||
# The system each container boots; updated on every rebuild.
|
||||
system = "${nbot.packages.${pkgs.stdenv.hostPlatform.system}.agent}";
|
||||
machines_dir = "/var/lib/machines";
|
||||
state_dir = "/var/lib/nbot";
|
||||
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 nbot-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
|
||||
{
|
||||
age.secrets = lib.genAttrs secrets (name: {
|
||||
file = skyg-secrets.${name};
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
});
|
||||
|
||||
# nbot flake input; options and docs in its repo.
|
||||
services.nbot = {
|
||||
enable = true;
|
||||
mode = "master";
|
||||
clusterPort = ports.cluster;
|
||||
configFile = (pkgs.formats.toml { }).generate "nbot.toml" settings;
|
||||
};
|
||||
|
||||
# The module takes one env file; these add to it.
|
||||
systemd.services.nbot.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 -" ];
|
||||
}
|
||||
@@ -48,33 +48,36 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets = lib.genAttrs secrets (name: {
|
||||
file = skyg-secrets.${name};
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
});
|
||||
# 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;
|
||||
# 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 -" ];
|
||||
};
|
||||
# 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,6 +1,6 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ./slackerbot.nix ];
|
||||
imports = [ ./slackerbot.nix ./nbot.nix ];
|
||||
|
||||
services.pipewire = {
|
||||
extraConfig.pipewire-pulse."10-raop-discover" = {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{ config, pkgs, nbot, skyg-secrets, ... }:
|
||||
let
|
||||
homes = "/var/lib/nbot/homes";
|
||||
settings = {
|
||||
# The system each container boots; updated on every rebuild.
|
||||
system = "${nbot.packages.${pkgs.stdenv.hostPlatform.system}.agent}";
|
||||
machines_dir = "/var/lib/machines";
|
||||
state_dir = "/var/lib/nbot";
|
||||
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
|
||||
{
|
||||
age.secrets.nbot-cluster = {
|
||||
file = skyg-secrets.nbot-cluster;
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
};
|
||||
|
||||
# nbot flake input; options and docs in its repo.
|
||||
services.nbot = {
|
||||
enable = true;
|
||||
mode = "slave";
|
||||
configFile = (pkgs.formats.toml { }).generate "nbot.toml" settings;
|
||||
environmentFile = config.age.secrets.nbot-cluster.path;
|
||||
};
|
||||
|
||||
# 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 -" ];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, pkgs, skyg-secrets, ... }:
|
||||
{ config, lib, pkgs, skyg-secrets, ... }:
|
||||
let
|
||||
homes = "/var/lib/slackerbot/homes";
|
||||
bazel = config.skyg.nixos.server.services.bazel-build;
|
||||
@@ -34,33 +34,36 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets.slackerbot-cluster = {
|
||||
file = skyg-secrets.slackerbot-cluster;
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
# 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 -" ];
|
||||
};
|
||||
|
||||
# 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 -" ];
|
||||
}
|
||||
Reference in new issue
Block a user