- Remove dead overlays/default.nix (flake defines overlays inline)
- Remove orphaned overlays/mods/{beads,n8n}.nix (never imported)
- Remove docs/packages/notesmd-cli.md (package doesn't exist)
- Extract externalSkills submodule to shared-options.nix (eliminates
~100 lines of duplication across opencode/claude-code/pi modules)
- Fix lib output: use nixpkgs.lib directly instead of instantiating
a full nixpkgs just to get lib
- Add lib unit tests to flake checks
- Update stale comment in coding-rules.nix
70 lines
2.2 KiB
Nix
70 lines
2.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
shared = import ./shared-options.nix {inherit lib;};
|
|
in
|
|
with lib; {
|
|
options.coding.agents.opencode = {
|
|
enable = mkEnableOption "OpenCode agent management via canonical agent.toml definitions";
|
|
|
|
agentsInput = shared.mkAgentsInputOption ''
|
|
The `agents` flake input (your personal AGENTS repo).
|
|
When set, agents are rendered from canonical agent.toml files
|
|
and symlinked to ~/.config/opencode/agents/.
|
|
'';
|
|
|
|
modelOverrides = shared.mkModelOverridesOption;
|
|
|
|
externalSkills = shared.externalSkillsOption;
|
|
};
|
|
|
|
config = mkIf config.coding.agents.opencode.enable {
|
|
# Rendered agent files symlinked to ~/.config/opencode/agents/
|
|
xdg.configFile."opencode/agents" = let
|
|
cfg = config.coding.agents.opencode;
|
|
in
|
|
mkIf (cfg.agentsInput != null) {
|
|
source = (import ../../../../lib {inherit lib;}).agents.renderForOpencode {
|
|
inherit pkgs;
|
|
canonical = cfg.agentsInput.lib.loadAgents;
|
|
modelOverrides = cfg.modelOverrides;
|
|
};
|
|
};
|
|
|
|
# Skills (merged from personal AGENTS repo + optional external skills)
|
|
xdg.configFile."opencode/skills" = let
|
|
cfg = config.coding.agents.opencode;
|
|
in
|
|
mkIf (cfg.agentsInput != null) {
|
|
source = cfg.agentsInput.lib.mkOpencodeSkills {
|
|
inherit pkgs;
|
|
customSkills = "${cfg.agentsInput}/skills";
|
|
externalSkills = shared.mapExternalSkills cfg.externalSkills;
|
|
};
|
|
};
|
|
|
|
# Static config dirs from AGENTS repo
|
|
xdg.configFile."opencode/context" = let
|
|
cfg = config.coding.agents.opencode;
|
|
in
|
|
mkIf (cfg.agentsInput != null) {
|
|
source = "${cfg.agentsInput}/context";
|
|
};
|
|
xdg.configFile."opencode/commands" = let
|
|
cfg = config.coding.agents.opencode;
|
|
in
|
|
mkIf (cfg.agentsInput != null) {
|
|
source = "${cfg.agentsInput}/commands";
|
|
};
|
|
xdg.configFile."opencode/prompts" = let
|
|
cfg = config.coding.agents.opencode;
|
|
in
|
|
mkIf (cfg.agentsInput != null) {
|
|
source = "${cfg.agentsInput}/prompts";
|
|
};
|
|
};
|
|
}
|