refactor(m3-kratos): use the T3 Code module from m3ta-home
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ba302a8a00
commit
aef9d84d61
3 files changed
+7
-131
No files matched your search
@@ -74,97 +74,6 @@
|
||||
opencode-desktop = final.llm-agents.opencode2-desktop;
|
||||
};
|
||||
|
||||
# T3 Code agents act as the m3ta-chiron bot on every host. Baked into the
|
||||
# T3 packages rather than a session or service: everything T3 spawns
|
||||
# inherits it, however T3 was launched (desktop launcher, systemd, shell),
|
||||
# and any host installing T3 gets it. Must come AFTER shared-nixpkgs.
|
||||
#
|
||||
# Push auth needs ~/.ssh/m3ta-chiron on each host, with its pubkey on the
|
||||
# m3ta-chiron Gitea account. A missing key fails the push instead of falling
|
||||
# back to a personal key. Other hosts keep the user's own ssh config.
|
||||
#
|
||||
# Change requests need the agenix secret hermes-gitea-token on each host,
|
||||
# owned by the T3 user. Without it T3 cannot recognize code.m3ta.dev as Gitea.
|
||||
t3code-agent-identity = final: prev: let
|
||||
identity = {
|
||||
name = "m3ta-chiron";
|
||||
email = "m3ta-chiron@agentmail.to";
|
||||
};
|
||||
|
||||
giteaKnownHosts = final.writeText "gitea-known-hosts" ''
|
||||
code.m3ta.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a
|
||||
'';
|
||||
|
||||
# ssh expands ~ from passwd, so this does not depend on $HOME.
|
||||
sshConfig = final.writeText "t3-agent-ssh-config" ''
|
||||
Host code.m3ta.dev
|
||||
User gitea
|
||||
IdentityFile ~/.ssh/m3ta-chiron
|
||||
IdentitiesOnly yes
|
||||
UserKnownHostsFile ${giteaKnownHosts}
|
||||
|
||||
# Conditional: IdentityFile accumulates across matching blocks, so a
|
||||
# personal code.m3ta.dev entry must not be read for this host.
|
||||
Host * !code.m3ta.dev
|
||||
Include ~/.ssh/config
|
||||
'';
|
||||
|
||||
# T3 only recognizes a Gitea on a custom domain through a matching tea
|
||||
# login. The config lives in a private temp dir per call, so the token stays
|
||||
# out of the nix store and a personal ~/.config/tea is left alone.
|
||||
giteaTokenFile = "/run/agenix/hermes-gitea-token";
|
||||
agentTea = final.writeShellApplication {
|
||||
name = "tea";
|
||||
text = ''
|
||||
config="$(${final.coreutils}/bin/mktemp -d)"
|
||||
trap '${final.coreutils}/bin/rm -rf "$config"' EXIT
|
||||
${final.coreutils}/bin/mkdir "$config/tea"
|
||||
if [ -r ${giteaTokenFile} ]; then
|
||||
${final.coreutils}/bin/cat > "$config/tea/config.yml" <<EOF
|
||||
logins:
|
||||
- name: m3ta
|
||||
url: https://code.m3ta.dev
|
||||
token: $(${final.coreutils}/bin/cat ${giteaTokenFile})
|
||||
user: ${identity.name}
|
||||
default: true
|
||||
EOF
|
||||
fi
|
||||
XDG_CONFIG_HOME="$config" ${final.tea}/bin/tea "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
wrapperArgs = final.lib.concatStringsSep " " (final.lib.mapAttrsToList (name: value: "--set ${name} ${final.lib.escapeShellArg value}") {
|
||||
GIT_AUTHOR_NAME = identity.name;
|
||||
GIT_AUTHOR_EMAIL = identity.email;
|
||||
GIT_COMMITTER_NAME = identity.name;
|
||||
GIT_COMMITTER_EMAIL = identity.email;
|
||||
JJ_USER = identity.name;
|
||||
JJ_EMAIL = identity.email;
|
||||
# bd otherwise falls back to the user's git user.name for its audit trail.
|
||||
BEADS_ACTOR = identity.name;
|
||||
GIT_SSH_COMMAND = "${final.openssh}/bin/ssh -F ${sshConfig}";
|
||||
});
|
||||
|
||||
wrapT3 = package:
|
||||
final.symlinkJoin {
|
||||
inherit (package) name meta passthru;
|
||||
paths = [package];
|
||||
nativeBuildInputs = [final.makeWrapper];
|
||||
postBuild = ''
|
||||
for program in $out/bin/*; do
|
||||
wrapProgram "$program" ${wrapperArgs} --prefix PATH : ${agentTea}/bin
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
llm-agents =
|
||||
prev.llm-agents
|
||||
// {
|
||||
t3code = wrapT3 prev.llm-agents.t3code;
|
||||
t3code-desktop = wrapT3 prev.llm-agents.t3code-desktop;
|
||||
};
|
||||
};
|
||||
|
||||
# temp-packages = final: _prev: {
|
||||
# temp = import inputs.nixpkgs-9e9486b {
|
||||
# system = final.stdenv.hostPlatform.system;
|
||||
|
||||
Reference in new issue
Block a user