Merge branch 'feat/t3code-module': T3 Code from the m3ta-home module
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
93e4429ab0
10 files changed
+34
-141
No files matched your search
Generated
+4
-4
@@ -709,11 +709,11 @@
|
|||||||
"nur": "nur"
|
"nur": "nur"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1793258213,
|
"lastModified": 1793618288,
|
||||||
"narHash": "sha256-77LJOHABdbX+cJ332xdTd7LEBoIo9r3lQccnD64p6RU=",
|
"narHash": "sha256-owOGoacp52y8Zxq366PhspAx6l76QEKS3ExJDIqncVg=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "5b192aadfe266733c35e40894c27fee716092294",
|
"rev": "a60a28fb9ceac08278160120431e194d2736d355",
|
||||||
"revCount": 166,
|
"revCount": 173,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://gitea@code.m3ta.dev/m3tam3re/m3ta-home"
|
"url": "ssh://gitea@code.m3ta.dev/m3tam3re/m3ta-home"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
./ports.nix
|
./ports.nix
|
||||||
./users
|
./users
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
inputs.m3ta-home.nixosModules.t3code
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.pathsToLink = ["/share/xdg-desktop-portal" "/share/applications"];
|
environment.pathsToLink = ["/share/xdg-desktop-portal" "/share/applications"];
|
||||||
@@ -50,7 +51,7 @@
|
|||||||
# overlays/default.nix.
|
# overlays/default.nix.
|
||||||
inputs.llm-agents.overlays.shared-nixpkgs
|
inputs.llm-agents.overlays.shared-nixpkgs
|
||||||
# Wraps pkgs.llm-agents.t3code* with the agents' m3ta-chiron identity.
|
# Wraps pkgs.llm-agents.t3code* with the agents' m3ta-chiron identity.
|
||||||
outputs.overlays.t3code-agent-identity
|
inputs.m3ta-home.overlays.t3code-agent-identity
|
||||||
# You can also add overlays exported from other flakes:
|
# You can also add overlays exported from other flakes:
|
||||||
# neovim-nightly-overlay.overlays.default
|
# neovim-nightly-overlay.overlays.default
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
age = {
|
age = {
|
||||||
secrets = {
|
secrets = {
|
||||||
hermes-gitea-token = {
|
agent-gitea-token-m3ta = {
|
||||||
file = ../../secrets/hermes-gitea-token.age;
|
file = ../../secrets/agent-gitea-token-m3ta.age;
|
||||||
owner = "m3tam3re";
|
owner = "m3tam3re";
|
||||||
};
|
};
|
||||||
hermes-env = {
|
hermes-env = {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
|
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
|
||||||
# (one-time keygen; pubkey added to the m3ta-chiron account) for
|
# (one-time keygen; pubkey added to the m3ta-chiron account) for
|
||||||
# interactive use and git+ssh:// flake inputs. Host key pinned system-wide.
|
# interactive use and git+ssh:// flake inputs. Host key pinned system-wide.
|
||||||
# - Gitea change requests: tea with the hermes-gitea-token agenix secret,
|
# - Gitea change requests: tea with the agent-gitea-token-m3ta agenix secret,
|
||||||
# baked into the same package.
|
# baked into the same package.
|
||||||
#
|
#
|
||||||
# One-time interactive steps after deploy (deliberately NOT declarative —
|
# One-time interactive steps after deploy (deliberately NOT declarative —
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
age = {
|
age = {
|
||||||
secrets = {
|
secrets = {
|
||||||
hermes-gitea-token = {
|
agent-gitea-token-m3ta = {
|
||||||
file = ../../secrets/hermes-gitea-token.age;
|
file = ../../secrets/agent-gitea-token-m3ta.age;
|
||||||
|
owner = "m3tam3re";
|
||||||
|
};
|
||||||
|
agent-gitea-token-az = {
|
||||||
|
file = ../../secrets/agent-gitea-token-az.age;
|
||||||
owner = "m3tam3re";
|
owner = "m3tam3re";
|
||||||
};
|
};
|
||||||
anytype-key = {
|
anytype-key = {
|
||||||
|
|||||||
@@ -1,41 +1,7 @@
|
|||||||
{
|
{config, ...}: {
|
||||||
config,
|
m3ta.t3code = {
|
||||||
pkgs,
|
enable = true;
|
||||||
...
|
user = "m3tam3re";
|
||||||
}: let
|
port = config.m3ta.ports.get "t3code";
|
||||||
port = config.m3ta.ports.get "t3code";
|
|
||||||
cockpitUser = "m3tam3re";
|
|
||||||
netbirdIp = "100.81.73.194";
|
|
||||||
in {
|
|
||||||
# T3 Code server: reachable from NetBird mesh peers only. It owns ~/.t3, so
|
|
||||||
# the desktop app must connect as a client with its local environment off.
|
|
||||||
systemd.services.t3code = {
|
|
||||||
description = "T3 Code server";
|
|
||||||
# Binding fails until NetBird has assigned the address; Restart retries.
|
|
||||||
after = ["netbird.service"];
|
|
||||||
wants = ["netbird.service"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
User = cockpitUser;
|
|
||||||
Group = "users";
|
|
||||||
WorkingDirectory = "/home/${cockpitUser}";
|
|
||||||
ExecStart = "${pkgs.llm-agents.t3code}/bin/t3 serve --host ${netbirdIp}";
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = "5";
|
|
||||||
};
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
T3CODE_PORT = toString port;
|
|
||||||
HOME = "/home/${cockpitUser}";
|
|
||||||
};
|
|
||||||
|
|
||||||
# The harnesses come from the user's profile, not from the service.
|
|
||||||
path = [
|
|
||||||
"/etc/profiles/per-user/${cockpitUser}"
|
|
||||||
"/run/current-system/sw"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.interfaces.wt0.allowedTCPPorts = [port];
|
|
||||||
}
|
}
|
||||||
@@ -74,97 +74,6 @@
|
|||||||
opencode-desktop = final.llm-agents.opencode2-desktop;
|
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-packages = final: _prev: {
|
||||||
# temp = import inputs.nixpkgs-9e9486b {
|
# temp = import inputs.nixpkgs-9e9486b {
|
||||||
# system = final.stdenv.hostPlatform.system;
|
# system = final.stdenv.hostPlatform.system;
|
||||||
|
|||||||
+2
-1
@@ -55,7 +55,8 @@ in {
|
|||||||
"secrets/hermes-env.age".publicKeys = systems ++ users;
|
"secrets/hermes-env.age".publicKeys = systems ++ users;
|
||||||
"secrets/hermes-cloud-env.age".publicKeys = systems ++ users;
|
"secrets/hermes-cloud-env.age".publicKeys = systems ++ users;
|
||||||
"secrets/hermes-api-server-key.age".publicKeys = systems ++ users;
|
"secrets/hermes-api-server-key.age".publicKeys = systems ++ users;
|
||||||
"secrets/hermes-gitea-token.age".publicKeys = systems ++ users;
|
"secrets/agent-gitea-token-m3ta.age".publicKeys = systems ++ users;
|
||||||
|
"secrets/agent-gitea-token-az.age".publicKeys = [m3-kratos] ++ users;
|
||||||
"secrets/tuwunel-registration-token.age".publicKeys = systems ++ users;
|
"secrets/tuwunel-registration-token.age".publicKeys = systems ++ users;
|
||||||
"secrets/ai-memory-server-env.age".publicKeys = [m3-hermes] ++ users;
|
"secrets/ai-memory-server-env.age".publicKeys = [m3-hermes] ++ users;
|
||||||
"secrets/ai-memory-hermes-token.age".publicKeys = [m3-hermes] ++ users;
|
"secrets/ai-memory-hermes-token.age".publicKeys = [m3-hermes] ++ users;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IDNCY3IxdyA3cDdZ
|
||||||
|
d1RIUGdOelJkL0ZZTldKYmNGRzN5RTQrSDVGNVE1dW1TaDdoR2xVCjZJTWZqVmFx
|
||||||
|
blZSemcyRjhXaHBXV1BTN3RNM0xLOVB6aGJlTlBvNnFmMFEKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgKytUcWFRICtab1hacXg2OE5QK3FRTlRVdmZoSmtUTThwUVU5dk14cnNnMzdM
|
||||||
|
RmVLV1kKTzJUNU12VnBzeW9yZjBYUUtmcUNxcmttMGVGV3VYNWhOcldSQkxXSndw
|
||||||
|
NAotPiBzc2gtZWQyNTUxOSBDU015aGcgdmdxVWI2UG5USFBWR24vRGpKQmF0QXlE
|
||||||
|
dFlqTFFsWHUxRlpDZitYUE1RRQpxS2cvTURGZUFjNVlwRmRtcVZ6bWhLRTZPa0lQ
|
||||||
|
U3pzSXhtazMxcXkrRnJnCi0tLSB3OUsyT2YzL05UVWhJMVEwdno4Z0U0WGhTb1Qx
|
||||||
|
SmNyVWNhZHVOeDdkVHFNCvfBDJ9SzlWGD3URDtM74LvjYRNcb33SCstNhwCYswur
|
||||||
|
dnu8OawdQeVcYV1dhAMW/16F/n/Nd9MSVkaW4K7tUsOs8XbCHTB7Fxg=
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
File renamed without changes.
Reference in new issue
Block a user