From c9ecc0809fb707de3a9765a562e7e1737e6962e3 Mon Sep 17 00:00:00 2001 From: Chiron Date: Sat, 18 Apr 2026 10:07:44 +0000 Subject: [PATCH] fix: add externalSkills option to pi agent module Skills from flake inputs (e.g. Basecamp) were not being passed to mkOpencodeSkills for the pi agent, so they never appeared in ~/.pi/agent/skills/. This adds the same externalSkills option that the opencode agent module already has. --- modules/home-manager/coding/agents/pi.nix | 47 ++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/modules/home-manager/coding/agents/pi.nix b/modules/home-manager/coding/agents/pi.nix index 9548435..0832f0b 100644 --- a/modules/home-manager/coding/agents/pi.nix +++ b/modules/home-manager/coding/agents/pi.nix @@ -51,6 +51,44 @@ in { ''; }; + externalSkills = mkOption { + type = types.listOf (types.submodule { + options = { + src = mkOption { + type = types.anything; + description = "Flake input pointing to a skills repository root."; + }; + skillsDir = mkOption { + type = types.str; + default = "skills"; + description = '' + Subdirectory inside src that contains skill folders. + ''; + }; + selectSkills = mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + description = '' + List of skill names to cherry-pick from this source. + null means include every skill found in skillsDir. + ''; + }; + }; + }); + default = []; + description = '' + External skill sources passed to mkOpencodeSkills. + Each entry maps directly to an element of the externalSkills + list accepted by the AGENTS flake's lib.mkOpencodeSkills. + ''; + example = literalExpression '' + [ + { src = inputs.skills-anthropic; selectSkills = [ "claude-api" ]; } + { src = inputs.basecamp; } + ] + ''; + }; + settings = mkOption { type = types.submodule { freeformType = types.attrsOf types.anything; @@ -222,11 +260,18 @@ in { # ── Agents — pi-subagents .md files ──────────────────────────── agentFiles - # ── Skills symlinked from AGENTS repo ────────────────────────── + # ── Skills symlinked from AGENTS repo + external skills ──────── (mkIf (cfg.agentsInput != null) { ".pi/agent/skills".source = cfg.agentsInput.lib.mkOpencodeSkills { inherit pkgs; customSkills = "${cfg.agentsInput}/skills"; + externalSkills = + map ( + entry: + {inherit (entry) src skillsDir;} + // optionalAttrs (entry.selectSkills != null) {inherit (entry) selectSkills;} + ) + cfg.externalSkills; }; }) ];