feat(prm-1): add T3 Code server and agent-lib skill sync

- Run T3 Code as a systemd service on AZ-PRM-1, reachable on the NetBird interface (port 3773), with its token in the agenix secret t3code-env
- Install claude-code, opencode, agent-lib and t3code in the sascha.koenig home profile on PRM-1
- Add an hourly agent-lib-sync timer that pulls skills and agents from agent-prod and links skills into ~/.claude/skills
- Add the numtide llm-agents binary cache to nix settings so the agent packages are not built locally
- Add a compat option shim for programs.nushell.loadSessionVariables until home-manager is upgraded to 26.11
- Update flake.lock inputs
- Remove the manual wartungsmodus rollout guide from docs/deploy
This commit is contained in:
2026-11-09 07:51:33 +01:00
parent 912e7617c1
commit cddb3c33d8
11 changed files with 208 additions and 262 deletions
+21
View File
@@ -0,0 +1,21 @@
# Home-Manager-Overrides fuer sascha.koenig auf AZ-PRM-1.
# Wird automatisch von hosts/common/users/sascha.koenig.nix eingebunden.
#
# T3 Code (hosts/AZ-PRM-1/services/t3code.nix) startet die Harnesses aus
# /etc/profiles/per-user/<user>, deshalb liegen sie hier im User-Profil.
{pkgs, ...}: {
home.packages = with pkgs; [
agent-lib
claude-code
opencode
# Gleiches Paket wie der Dienst: fuer `t3 pair` & Co. gegen ~/.t3.
t3code
];
# Gleiche Quelle wie der Timer agent-lib-sync, damit ein manuelles
# `agent-lib sync` / `agent-lib status` ohne --repo funktioniert.
xdg.configFile."agent-lib/config.json".text = builtins.toJSON {
repo_url = "https://code.m3ta.dev/m3tam3re/agent-prod.git";
ref = "master";
};
}
+6
View File
@@ -93,6 +93,12 @@ in {
technitium-env = {
file = ../../secrets/technitium-env.age;
};
# Harness-Tokens fuer den T3-Code-Server (systemd EnvironmentFile).
t3code-env = {
file = ../../secrets/t3code-env.age;
owner = "sascha.koenig";
mode = "0400";
};
}
// lib.optionalAttrs (builtins.pathExists ntfyGrafanaWebhookSecret) {
ntfy-grafana-webhook = {
+1
View File
@@ -13,6 +13,7 @@
./phishboard.nix
./postgres.nix
./printing.nix
./t3code.nix
./traefik.nix
./traefik-routing.nix
./zugferd.nix
+103
View File
@@ -0,0 +1,103 @@
# T3 Code Server + agent-lib Skill-Sync auf AZ-PRM-1.
#
# T3 Code laeuft als systemd-Dienst ueber das m3ta-home-Modul und ist nur im
# NetBird-Netz (wt0) erreichbar. Die Harnesses (claude-code, opencode) kommen
# aus dem Home-Manager-Profil des Benutzers (hosts/AZ-PRM-1/home.nix), nicht
# aus dem Dienst selbst.
#
# agent-lib zieht Skills und Agents aus dem Arbeits-Repo agent-prod nach
# ~/.agents/skills und ~/.config/opencode/{agents,commands}. Claude Code liest
# ~/.claude/skills, deshalb werden die Skill-Ordner danach dorthin verlinkt
# (gleiche Logik wie m3ta-home profiles/sets/coding/agents/claude-skills.nix,
# hier jedoch im System-Dienst, weil es auf dem Server keine User-Session gibt).
#
# Erst-Deploy: Der Dienst haengt am wt0-Device und startet nicht automatisch,
# wenn das Interface beim Aktivieren schon oben ist -> einmal
# `systemctl start t3code`. Danach `systemctl start agent-lib-sync` fuer den
# ersten Skill-Abgleich (sonst laeuft er beim naechsten Timer-Tick).
{
config,
inputs,
lib,
pkgs,
...
}: let
user = "sascha.koenig";
home = config.users.users.${user}.home;
agentProdRepo = "https://code.m3ta.dev/m3tam3re/agent-prod.git";
agentProdRef = "master";
skillsSrc = "${home}/.agents/skills";
skillsDst = "${home}/.claude/skills";
agentLibSync = pkgs.writeShellApplication {
name = "agent-lib-sync";
runtimeInputs = [pkgs.agent-lib pkgs.coreutils];
text = ''
src=${lib.escapeShellArg skillsSrc}
dst=${lib.escapeShellArg skillsDst}
agent-lib sync --repo ${lib.escapeShellArg agentProdRepo} --ref ${lib.escapeShellArg agentProdRef}
mkdir -p "$src" "$dst"
# Links in $dst entfernen, deren Ziel in $src verschwunden ist.
for link in "$dst"/*; do
[ -L "$link" ] || continue
case "$(readlink "$link")" in
"$src"/*) [ -e "$link" ] || rm -f "$link" ;;
esac
done
# Jeden Skill-Ordner verlinken; echte Ordner oder fremde Links nie ersetzen.
for skill in "$src"/*/; do
skill="''${skill%/}"
[ -f "$skill/SKILL.md" ] || continue
name="$(basename "$skill")"
target="$dst/$name"
if [ -L "$target" ] || [ ! -e "$target" ]; then
ln -sfn "$skill" "$target"
fi
done
'';
};
in {
imports = [inputs.m3ta-home.nixosModules.t3code];
m3ta.t3code = {
enable = true;
inherit user;
port = config.m3ta.ports.get "t3code";
# Die llm-agents-Pakete liegen hier flach in pkgs (mkLlmAgentsOverlay),
# nicht unter pkgs.llm-agents wie im Modul-Default.
package = pkgs.t3code;
environmentFile = config.age.secrets.t3code-env.path;
};
# Stuendlicher Skill-Abgleich aus agent-prod ("Cron-Job").
systemd.services.agent-lib-sync = {
description = "agent-lib: Skills/Agents aus agent-prod synchronisieren";
after = ["network-online.target"];
wants = ["network-online.target"];
serviceConfig = {
Type = "oneshot";
User = user;
Group = "users";
WorkingDirectory = home;
ExecStart = lib.getExe agentLibSync;
};
environment.HOME = home;
};
systemd.timers.agent-lib-sync = {
description = "agent-lib Skill-Sync (stuendlich)";
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "5min";
OnCalendar = "hourly";
RandomizedDelaySec = "10min";
Persistent = true;
};
};
}