- Renamed shared-options.nix to shared/shared-options.nix - Created shared/default.nix importing git-identity.nix and shared-options.nix - Created shared/git-identity.nix with gitIdentity option set: - enable: Toggle for agent git identity - name: Git author name (default: m3ta-chiron) - email: Git author email (default: m3ta-chiron@agentmail.to) - signingKey: Optional GPG signing key path - sshKey: SSH private key path for git push auth - Updated opencode.nix, pi.nix, claude-code.nix to import shared/default.nix - Restructured modules to follow proper Nix module syntax with imports at top level
78 lines
2.4 KiB
Nix
78 lines
2.4 KiB
Nix
# Shared option definitions for agent modules.
|
|
# Prevents copy-pasting the externalSkills submodule across opencode/claude-code/pi.
|
|
{lib}: let
|
|
inherit (lib) mkOption mkEnableOption types literalExpression;
|
|
in {
|
|
# Common agentsInput option used by all agent modules.
|
|
mkAgentsInputOption = description:
|
|
mkOption {
|
|
type = types.nullOr types.anything;
|
|
default = null;
|
|
inherit description;
|
|
};
|
|
|
|
# Common modelOverrides option.
|
|
mkModelOverridesOption = mkOption {
|
|
type = types.attrsOf types.str;
|
|
default = {};
|
|
description = ''
|
|
Per-agent model overrides. Maps agent slug to model string.
|
|
Example: { chiron = "anthropic/claude-sonnet-4"; }
|
|
'';
|
|
example = literalExpression ''
|
|
{
|
|
chiron = "anthropic/claude-sonnet-4";
|
|
"chiron-forge" = "anthropic/claude-sonnet-4";
|
|
}
|
|
'';
|
|
};
|
|
|
|
# External skills submodule — used by opencode, claude-code, and pi modules.
|
|
externalSkillsOption = 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; }
|
|
]
|
|
'';
|
|
};
|
|
|
|
# Helper to map externalSkills from module config to mkOpencodeSkills format.
|
|
mapExternalSkills = cfgEntries:
|
|
map (
|
|
entry:
|
|
{inherit (entry) src skillsDir;}
|
|
// lib.optionalAttrs (entry.selectSkills != null) {inherit (entry) selectSkills;}
|
|
)
|
|
cfgEntries;
|
|
}
|