diff --git a/flake.lock b/flake.lock index 6d6bdb9..448799e 100644 --- a/flake.lock +++ b/flake.lock @@ -2204,11 +2204,11 @@ ] }, "locked": { - "lastModified": 1794432179, - "narHash": "sha256-473TO/GoK1dbQR/RgYeniCXDC+hVHzBUYEU2Ig6Ta24=", + "lastModified": 1794451827, + "narHash": "sha256-st0azs0AMQkizHPzX9U0EypA4/wWYrruHQezeBy74ng=", "ref": "refs/heads/main", - "rev": "f23eb0352c48ec5b279b8dcb7280c19b0da58cbe", - "revCount": 1304, + "rev": "02edfaf66315952458bb0fa69c87aa0aecd36c31", + "revCount": 1325, "type": "git", "url": "ssh://git@github.com/asosnovsky/nbot.git" }, diff --git a/hosts/hl-fwdesk/services/nbot.nix b/hosts/hl-fwdesk/services/nbot.nix index bd5cc99..140b9f7 100644 --- a/hosts/hl-fwdesk/services/nbot.nix +++ b/hosts/hl-fwdesk/services/nbot.nix @@ -2,6 +2,7 @@ let ports = { cluster = 7946; }; homes = "/data/nbot"; + goCache = "/data/nbot-cache/go"; secrets = [ "nbot-slack" "nbot-goose" "nbot-cluster" ]; settings = { # The system each container boots (nbot's agent + gh); updated on every rebuild. @@ -15,6 +16,12 @@ let allow_indefinite = true; boot_timeout = "2m"; + # Go caches shared by all containers on this node (see ABOUTME). Env vars are in agent_env. + rw_binds = [ + "${goCache}/mod:/var/cache/go/mod:idmap" + "${goCache}/build:/var/cache/go/build:idmap" + ]; + summaries = { timeout = "10s"; }; @@ -29,6 +36,9 @@ let COMMAND_CODE_API_KEY = "$COMMAND_CODE_API_KEY"; GH_TOKEN = "$GH_TOKEN"; DIAGNIX_KEY = "$DIAGNIX_KEY"; # base64 private key for lab-ssh (diagnix) + # Shared Go caches, mounted by rw_binds on each node. + GOMODCACHE = "/var/cache/go/mod"; + GOCACHE = "/var/cache/go/build"; }; model_providers = [ @@ -132,5 +142,9 @@ in networking.networkmanager.unmanaged = [ "interface-name:ve-*" ]; networking.dhcpcd.denyInterfaces = [ "ve-*" ]; - systemd.tmpfiles.rules = [ "d ${homes} 0700 root root -" ]; + systemd.tmpfiles.rules = [ + "d ${homes} 0700 root root -" + "d ${goCache}/mod 0700 root root -" + "d ${goCache}/build 0700 root root -" + ]; } diff --git a/hosts/hl-fws1/services/nbot.nix b/hosts/hl-fws1/services/nbot.nix index 99b1aa0..abce22c 100644 --- a/hosts/hl-fws1/services/nbot.nix +++ b/hosts/hl-fws1/services/nbot.nix @@ -1,6 +1,7 @@ { config, pkgs, skyg-secrets, ... }: let homes = "/var/lib/nbot/homes"; + goCache = "/var/lib/nbot-cache/go"; settings = { # The system each container boots (nbot's agent + gh); updated on every rebuild. system = "${config.skyg.nixos.server.services.nbot-agent.system}"; @@ -13,6 +14,12 @@ let allow_indefinite = true; boot_timeout = "2m"; + # Go caches shared by all containers on this node (see ABOUTME). Env vars come from the master. + rw_binds = [ + "${goCache}/mod:/var/cache/go/mod:idmap" + "${goCache}/build:/var/cache/go/build:idmap" + ]; + container = { memory_mb = 4096; cpus = 1.0; }; max_container = { memory_mb = 51200; cpus = 6; }; host_reserve = { memory_mb = 8192; cpus = 2.0; }; @@ -54,5 +61,9 @@ in # so wait-online would always time out. systemd.network.wait-online.enable = false; - systemd.tmpfiles.rules = [ "d ${homes} 0700 root root -" ]; + systemd.tmpfiles.rules = [ + "d ${homes} 0700 root root -" + "d ${goCache}/mod 0700 root root -" + "d ${goCache}/build 0700 root root -" + ]; } diff --git a/modules/nixos/server/services/ABOUTME.md b/modules/nixos/server/services/ABOUTME.md index ee6a7be..f0fc2c5 100644 --- a/modules/nixos/server/services/ABOUTME.md +++ b/modules/nixos/server/services/ABOUTME.md @@ -28,6 +28,12 @@ services/ repo unchanged. `gh` reads `GH_TOKEN` from `agent_env`, and git over HTTPS to github.com uses it through `gh`. Every container gets that token (chosen on purpose, 2026-11-03), so anyone who can prompt an agent can use it or ask it to print the token. +- **Shared Go caches** (2026-11-11, set in `hosts/hl-{fwdesk,fws1}/services/nbot.nix`, not + here): each node bind-mounts one `GOMODCACHE` and `GOCACHE` into every container under + `/var/cache/go/`, with the env vars in the master's `agent_env`. Go locks these, so sharing + is safe. Only Go caches are shared, not all of `~/.cache`: other tools break or leak logins + when shared, and it would skip each home's size limit. Trade-off: any container can change + build results the others use. The caches have no size limit; clear with `go clean -cache`. - **`colibri.nix`** runs `coli serve` (colibrì's OpenAI-compatible API) as a native systemd service. `package` picks the backend (`pkgs.colibri` cpu / `pkgs.colibri-rocm`); `environmentFile` supplies `COLI_API_KEY` via agenix instead of