- Import the m3ta-home agent modules (mcp, claude-code, opencode,
ai-memory, claude-skills) in hosts/AZ-PRM-1/home.nix instead of the
hand-rolled claude-code/opencode packages; Claude Code and OpenCode get
the shared MCP catalogue, ai-memory hooks/MCP/skills, LiteLLM/Z.AI
providers and the m3ta-chiron git identity
- Expose the flattened llm-agents packages additionally as pkgs.llm-agents
so m3ta-home modules and the t3code-agent-identity overlay work here
- Apply m3ta-home's t3code-agent-identity overlay (T3 agents commit as
m3ta-chiron), t3code service uses the wrapped module default package
- agent-lib-sync timer calls claude-skills-sync from the user profile
instead of duplicating the link logic
- Secrets for AZ-PRM-1 (same values as AZ-LT-NIX): ai-memory-token,
agent-gitea-token-{m3ta,az}; exa-key/ref-key now owned by sascha.koenig
- flake.lock: m3ta-home -> f4ab2ab (Claude MCP integration, PR #9)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
86 lines
2.9 KiB
Nix
86 lines
2.9 KiB
Nix
# 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 ruft der Timer danach claude-skills-sync aus dem
|
|
# User-Profil auf (m3ta-home profiles/sets/coding/agents/claude-skills.nix,
|
|
# eingebunden in hosts/AZ-PRM-1/home.nix). Dessen Path-Unit im User-systemd
|
|
# laeuft auf dem Server nicht (keine User-Session), der System-Timer hier
|
|
# uebernimmt das.
|
|
#
|
|
# 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";
|
|
|
|
# claude-skills-sync kommt aus dem Home-Manager-Profil des Benutzers.
|
|
claudeSkillsSync = "/etc/profiles/per-user/${user}/bin/claude-skills-sync";
|
|
|
|
agentLibSync = pkgs.writeShellApplication {
|
|
name = "agent-lib-sync";
|
|
runtimeInputs = [pkgs.agent-lib pkgs.coreutils];
|
|
text = ''
|
|
agent-lib sync --repo ${lib.escapeShellArg agentProdRepo} --ref ${lib.escapeShellArg agentProdRef}
|
|
if [ -x ${claudeSkillsSync} ]; then
|
|
${claudeSkillsSync}
|
|
else
|
|
echo "warn: ${claudeSkillsSync} fehlt (Home-Manager noch nicht aktiviert?)" >&2
|
|
fi
|
|
'';
|
|
};
|
|
in {
|
|
imports = [inputs.m3ta-home.nixosModules.t3code];
|
|
|
|
m3ta.t3code = {
|
|
enable = true;
|
|
inherit user;
|
|
port = config.m3ta.ports.get "t3code";
|
|
# Modul-Default pkgs.llm-agents.t3code: Namespace aus mkLlmAgentsOverlay,
|
|
# mit m3ta-chiron-Identitaet gewrappt (overlays.t3code-agent-identity).
|
|
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;
|
|
};
|
|
};
|
|
}
|