diff --git a/hosts/m3-hermes/services/t3code.nix b/hosts/m3-hermes/services/t3code.nix index 1e3297b..7333cc6 100644 --- a/hosts/m3-hermes/services/t3code.nix +++ b/hosts/m3-hermes/services/t3code.nix @@ -7,8 +7,9 @@ # - Lane 3, control & inbox: Hermes via Matrix (unchanged). # # Flow: T3 desktop/mobile app ──NetBird mesh──▶ wt0 :3773 (this server). -# The server binds 0.0.0.0, but the firewall admits the port for mesh -# peers only — same posture as ai-memory and the hermes dashboard. +# The server itself comes from m3ta-home's t3code module: it binds the +# current NetBird address of wt0 and opens the port on wt0 only. This file +# adds the hermes-specific agent runtime around it. # # Agent runtime for the T3 harnesses (OpenCode / Claude Code, 2026-10-31): # - Skills/commands/agents via agent-lib v2: a timer syncs the work repo @@ -17,7 +18,7 @@ # path unit mirrors skills into ~/.claude/skills for Claude Code # (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix). # - Git identity and Gitea push auth: m3ta-chiron for every harness spawned -# by T3, baked into the package (overlays/default.nix, +# by T3, baked into the package (m3ta-home overlay # t3code-agent-identity), so m3tam3re's interactive git is untouched. # - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea # (one-time keygen; pubkey added to the m3ta-chiron account) for @@ -47,10 +48,6 @@ pkgs, ... }: let - # Mesh-only via interface match on wt0 (NetBird) — an IPv4 CIDR in -s - # would abort the ip6tables run of ip46tables and fail the unit. - port = config.m3ta.ports.get "t3code"; - # ── Lane-1 agent runtime ───────────────────────────────────────────── cockpitUser = "m3tam3re"; cockpitHome = "/home/${cockpitUser}"; @@ -111,38 +108,13 @@ in { pkgs.agent-lib ]; - # ── T3 Code server (system service, cockpit user) ──────────────────── - systemd.services.t3code = { - description = "T3 Code server (interactive coding-agent cockpit)"; - after = ["network-online.target"]; - wants = ["network-online.target"]; - wantedBy = ["multi-user.target"]; - - serviceConfig = { - User = "m3tam3re"; - Group = "users"; - WorkingDirectory = "/home/m3tam3re"; - ExecStart = "${pkgs.llm-agents.t3code}/bin/t3 serve --host 0.0.0.0"; - Restart = "on-failure"; - RestartSec = "5"; - }; - - environment = { - T3CODE_PORT = toString port; - # Deterministic service context: HOME explicit so tools resolve ~ in - # every process this service spawns, however deep t3's pty/sandbox - # chain resets the environment. - HOME = cockpitHome; - }; - - # Harness CLIs, git and the issue tracker for the agents T3 Code spawns. - path = with pkgs; [ - git - openssh - llm-agents.opencode2 - llm-agents.claude-code - llm-agents.beads - ]; + # ── T3 Code server (m3ta-home module, cockpit user) ───────────────── + # The harnesses, git and beads for the agents come from the system + # profile above (the module puts /run/current-system/sw on the path). + m3ta.t3code = { + enable = true; + user = cockpitUser; + port = config.m3ta.ports.get "t3code"; }; # ── Gitea (code.m3ta.dev) for the T3 lane ──────────────────────────── @@ -215,15 +187,4 @@ in { }; environment.HOME = cockpitHome; }; - - networking.firewall = { - extraCommands = '' - # Allow t3code only from Netbird mesh VPN - ip46tables -A nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept - ''; - - extraStopCommands = '' - ip46tables -D nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept 2>/dev/null || true - ''; - }; }