docs: correct spec+plan for self-vs-inputs in imports

The fix subagent found that inputs.hermes-agent.nixosModules.default
inside `imports` causes infinite recursion in this repo's wiring
(inputs comes from _module.args, which merges after imports resolve;
self comes from specialArgs, which is available at import-time).
Tested both ways. Update docs to show self.inputs, matching commit
31e1910.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vbvwg3Qt2u9nbkEA3wL17S
This commit is contained in:
2026-09-08 17:51:31 +02:00
co-authored by Claude Sonnet 5
parent 31e1910d75
commit 0756eb94cd
2 changed files with 24 additions and 12 deletions
@@ -48,10 +48,16 @@ hermes-agent = {
```
Import the upstream module **from inside the profile module itself**, via
`imports = [ inputs.hermes-agent.nixosModules.default ];` — using the
`inputs` module arg already provided repo-wide by
`_module.args.inputs = self.inputs;` in `machines/configuration.nix`.
**Correction (found during implementation, 2026-09-08):** this is
`imports = [ self.inputs.hermes-agent.nixosModules.default ];` — using
`self` (available via `specialArgs = { inherit self; };` in
`machines/configuration.nix`), not the `inputs` module arg. **Correction
(found during implementation, 2026-09-08):** `inputs` is supplied via
`_module.args.inputs = self.inputs;`, set inside a config block — but
NixOS resolves a module's `imports` list before `_module.args` assignments
merge, so anything referenced inside `imports` must come from
`specialArgs` (fixed up front) instead. Using `inputs` here reproduces
`infinite recursion encountered`; `self.inputs.hermes-agent` is the same
flake input, reached the way that actually works. Separately, this is
deliberately *not* wired through `machines/configuration.nix`'s per-machine
module lists. NixOS's module system errors on a definition for an
undeclared option regardless of `lib.mkIf`'s condition — so declaring
@@ -72,14 +78,14 @@ repo's standard profile pattern:
config,
lib,
pkgs,
inputs,
self,
...
}:
let
cfg = config.my.profiles.hermes-agent;
in
{
imports = [ inputs.hermes-agent.nixosModules.default ];
imports = [ self.inputs.hermes-agent.nixosModules.default ];
options.my.profiles.hermes-agent.enable =
lib.mkEnableOption "Hermes Agent (Telegram + Email gateway)";