Deduplicate MCP logic in ai-agents/ai-runtime and replace builtins.pathExists on secrets #275

Closed
opened 2026-10-06 20:08:35 +01:00 by nimmo · 0 comments
Owner

Context & Problem

In modules/profiles/ai-agents.nix and modules/profiles/ai-runtime.nix:

  • Approximately 60 lines of let ... in bindings (Pangolin, Bookstack, Karakeep, Synthseek, Navidrome, KiwiFS token lookups and launchers) are duplicated verbatim between both modules.
  • Both files use builtins.pathExists on secret file paths to conditionally enable MCP servers (e.g. builtins.pathExists ../../secrets/karakeep.yaml). In pure flake mode, pathExists only sees the Git index and leads to implicit, side-effect-driven configuration toggling rather than declarative option control.
  • ai-agents.nix imports server daemon modules (../services/kiwifs.nix and ../services/navidrome-mcp.nix) onto AI client machines solely to obtain their client option definitions.

Scope

  • modules/profiles/ai-agents.nix
  • modules/profiles/ai-runtime.nix
  • modules/profiles/ai-desktop.nix
  • modules/services/kiwifs.nix
  • modules/services/navidrome-mcp.nix

Implementation Checklist

  • Extract shared MCP launcher definitions and client configuration into a single common module or option set.
  • Replace builtins.pathExists on secrets files with explicit declarative boolean options (e.g. nixosConfig.mcp.<service>.enable or similar).
  • Separate client MCP options from server daemon implementations for KiwiFS and Navidrome so client hosts do not import server service definitions.
  • Verify Codex, OpenCode, and Antigravity CLI work with identical configurations on Electra, Lena, Vega, and Lyra.

Completion Criteria

  • No duplicated MCP binding blocks across ai-agents.nix and ai-runtime.nix.
  • No builtins.pathExists calls on secret paths.
  • nix flake check passes.
## Context & Problem In `modules/profiles/ai-agents.nix` and `modules/profiles/ai-runtime.nix`: - Approximately 60 lines of `let ... in` bindings (Pangolin, Bookstack, Karakeep, Synthseek, Navidrome, KiwiFS token lookups and launchers) are duplicated verbatim between both modules. - Both files use `builtins.pathExists` on secret file paths to conditionally enable MCP servers (e.g. `builtins.pathExists ../../secrets/karakeep.yaml`). In pure flake mode, `pathExists` only sees the Git index and leads to implicit, side-effect-driven configuration toggling rather than declarative option control. - `ai-agents.nix` imports server daemon modules (`../services/kiwifs.nix` and `../services/navidrome-mcp.nix`) onto AI client machines solely to obtain their client option definitions. ## Scope - `modules/profiles/ai-agents.nix` - `modules/profiles/ai-runtime.nix` - `modules/profiles/ai-desktop.nix` - `modules/services/kiwifs.nix` - `modules/services/navidrome-mcp.nix` ## Implementation Checklist - [ ] Extract shared MCP launcher definitions and client configuration into a single common module or option set. - [ ] Replace `builtins.pathExists` on secrets files with explicit declarative boolean options (e.g. `nixosConfig.mcp.<service>.enable` or similar). - [ ] Separate client MCP options from server daemon implementations for KiwiFS and Navidrome so client hosts do not import server service definitions. - [ ] Verify Codex, OpenCode, and Antigravity CLI work with identical configurations on Electra, Lena, Vega, and Lyra. ## Completion Criteria - No duplicated MCP binding blocks across `ai-agents.nix` and `ai-runtime.nix`. - No `builtins.pathExists` calls on secret paths. - `nix flake check` passes.
nimmo closed this issue 2026-10-07 15:21:04 +01:00
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config#275
No description provided.