From 797ffb2b8aec2f535ca4d297e484929720be7b8c Mon Sep 17 00:00:00 2001 From: m3tm3re
Date: Sun, 26 Apr 2026 11:17:03 +0200 Subject: [PATCH] fix: assert unknown profiles in mkHomeConfig; move agent modules to coding/agents - home/lib/default.nix: add assertion for unknown profile names instead of silently filtering them out; remove unused 'inherit (lib) optional' - home/coding/agents/{opencode,pi}.nix: moved from home/features/coding/ to co-locate with agents.nix (eliminating cross-directory back-references) - home/coding/agents/agents.nix: update imports to ./opencode.nix and ./pi.nix - home/features/coding/: remove now-dead default.nix (nothing imported it) --- home/coding/agents/agents.nix | 4 +- .../coding => coding/agents}/opencode.nix | 0 .../{features/coding => coding/agents}/pi.nix | 0 home/features/coding/default.nix | 101 ------------------ home/lib/default.nix | 16 ++- 5 files changed, 16 insertions(+), 105 deletions(-) rename home/{features/coding => coding/agents}/opencode.nix (100%) rename home/{features/coding => coding/agents}/pi.nix (100%) delete mode 100644 home/features/coding/default.nix diff --git a/home/coding/agents/agents.nix b/home/coding/agents/agents.nix index 2945551..2524823 100644 --- a/home/coding/agents/agents.nix +++ b/home/coding/agents/agents.nix @@ -19,8 +19,8 @@ in { imports = [ # OpenCode and Pi agent configurations - ../../features/coding/opencode.nix - ../../features/coding/pi.nix + ./opencode.nix + ./pi.nix ]; coding.agents.skills = { diff --git a/home/features/coding/opencode.nix b/home/coding/agents/opencode.nix similarity index 100% rename from home/features/coding/opencode.nix rename to home/coding/agents/opencode.nix diff --git a/home/features/coding/pi.nix b/home/coding/agents/pi.nix similarity index 100% rename from home/features/coding/pi.nix rename to home/coding/agents/pi.nix diff --git a/home/features/coding/default.nix b/home/features/coding/default.nix deleted file mode 100644 index 3011a6b..0000000 --- a/home/features/coding/default.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ - config, - inputs, - pkgs, - videoDrivers, - ... -}: let - npmGlobalPrefix = "${config.home.homeDirectory}/.npm-global"; -in { - home.file.".npmrc".text = '' - prefix=${npmGlobalPrefix} - ''; - home.sessionVariables.NPM_CONFIG_PREFIX = npmGlobalPrefix; - imports = [ - ./opencode.nix - ./pi.nix - ]; - - coding.agents.skills = { - agentsInput = inputs.agents; - externalSkills = [ - { - src = inputs.skills-anthropic; - selectSkills = ["pdf" "docx" "frontend-design"]; - } - {src = inputs.skills-vercel;} - {src = inputs.skills-basecamp;} - {src = inputs.skills-kestra;} - ]; - }; - - programs.mcp = { - enable = true; - servers = { - DeepWiki = { - url = "https://mcp.deepwiki.com/mcp"; - }; - Ref = { - command = "bash"; - args = ["-c" "REF_API_KEY=$(cat /run/agenix/ref-key) exec bunx ref-tools-mcp@latest"]; - }; - Exa = { - command = "bash"; - args = ["-c" "EXA_API_KEY=$(cat /run/agenix/exa-key) exec bunx exa-mcp-server@latest tools=web_search_exa"]; - }; - Outline = { - url = "https://wiki.az-gruppe.com/mcp"; - }; - ContextMode = { - command = "bash"; - args = ["-c" "exec bunx context-mode@latest"]; - }; - Honcho = { - command = "bash"; - args = [ - "-c" - ''exec bunx mcp-remote@latest https://mcp.honcho.dev --header "Authorization:Bearer $(cat /run/agenix/honcho-key)" --header "X-Honcho-User-Name:m3tam3re"'' - ]; - }; - }; - }; - - home.packages = with pkgs; [ - agenix-cli - agent-browser - alejandra - bc - bun - devpod - #devpod-desktop - gnumake - cmake - (python3.withPackages (ps: - with ps; [ - pip - uv - # Scientific packages - numba - numpy - torch - srt - ])) - pyrefly - nixd - nix-update - nodejs - # opencode-desktop - (qmd.override { - vulkanSupport = videoDrivers == ["amdgpu"]; - cudaSupport = videoDrivers == ["nvidia"]; - }) - openshell - openspec - pi-coding-agent - alejandra - sidecar - tailwindcss - tailwindcss-language-server - td - ]; -} diff --git a/home/lib/default.nix b/home/lib/default.nix index d527a28..adb2a77 100644 --- a/home/lib/default.nix +++ b/home/lib/default.nix @@ -11,8 +11,6 @@ { lib }: let - inherit (lib) optional; - # Infrastructure layer — nixpkgs overlays, nix-colors, m3ta-nixpkgs modules. # Always loaded on every host. commonModule = ../common; @@ -55,6 +53,12 @@ in { else if context == "server" then [ contextModuleMap.server ] else []; + # Partition profiles into known and unknown for assertion + safe import. + unknownProfiles = builtins.filter + (profileName: ! builtins.hasAttr profileName profileModuleMap) + profiles; + + # Only import known profiles; the assertion below catches unknowns. activeProfiles = builtins.filter (profileName: builtins.hasAttr profileName profileModuleMap) profiles; @@ -76,6 +80,14 @@ in { "m3ta home: context must be 'desktop', 'server', or null" + " (got: '${contextStr}')"; } + { + assertion = unknownProfiles == []; + message = + "m3ta home: unknown profiles requested:" + + " [ ${builtins.concatStringsSep " " unknownProfiles} ]." + + " Valid profiles are:" + + " [ ${builtins.concatStringsSep " " (builtins.attrNames profileModuleMap)} ]"; + } ]; }; }