diff --git a/docs/superpowers/specs/2026-11-02-t3code-nixos-module-design.md b/docs/superpowers/specs/2026-11-02-t3code-nixos-module-design.md index 29229fd..a743bf1 100644 --- a/docs/superpowers/specs/2026-11-02-t3code-nixos-module-design.md +++ b/docs/superpowers/specs/2026-11-02-t3code-nixos-module-design.md @@ -35,6 +35,7 @@ Agents committen auf beiden Hosts als `m3ta-chiron`. | `m3ta.t3code.port` | port | `3773` | | `m3ta.t3code.interface` | str | `"wt0"` | | `m3ta.t3code.package` | package | `pkgs.llm-agents.t3code` | +| `m3ta.t3code.environmentFile` | null oder absoluter Pfad außerhalb des Stores | `null` | Eine Assertion verlangt `services.netbird.enable = true`. @@ -42,6 +43,7 @@ Eine Assertion verlangt `services.netbird.enable = true`. - Läuft als `user` mit Gruppe `users`; `HOME` und `WorkingDirectory` kommen aus `config.users.users..home`. - `T3CODE_PORT` kommt aus `port`. +- `environmentFile` wird, falls gesetzt, als `EnvironmentFile` geladen (`KEY=value`-Zeilen, z. B. ein agenix-Secret). - `path` enthält `/etc/profiles/per-user/` und `/run/current-system/sw`. - `Restart = "on-failure"`, `RestartSec = 5`. - `bindsTo`, `after` und `wantedBy` zeigen auf `sys-subsystem-net-devices-.device`. diff --git a/modules/nixos/t3code.nix b/modules/nixos/t3code.nix index 6620854..4286920 100644 --- a/modules/nixos/t3code.nix +++ b/modules/nixos/t3code.nix @@ -52,6 +52,20 @@ in { defaultText = lib.literalExpression "pkgs.llm-agents.t3code"; description = "T3 Code package."; }; + + environmentFile = lib.mkOption { + type = lib.types.nullOr (lib.types.pathWith { + inStore = false; + absolute = true; + }); + default = null; + example = "/run/agenix/t3code-env"; + description = '' + File with `KEY=value` lines loaded into the server's environment + (systemd `EnvironmentFile`), e.g. tokens for the harnesses. Keep it + outside the Nix store, for example as an agenix secret. + ''; + }; }; config = lib.mkIf cfg.enable { @@ -75,6 +89,7 @@ in { ExecStart = "${serve}/bin/t3code-serve ${cfg.interface} ${cfg.package}/bin/t3"; Restart = "on-failure"; RestartSec = "5"; + EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile; }; environment = {