feat: cover pi and opencode in the home-manager module

They have no @file imports, so the module concatenates the shared
claude-md fragments into one AGENTS.md per tool (.pi/agent/ and
.config/opencode/), and links commands/ into opencode's commands dir.
Skills need nothing: pi reads ~/.agents/skills and opencode auto-loads
both skill roots, all already linked.
This commit is contained in:
Miguel Palhas
2026-08-19 15:13:51 +01:00
parent cc78bcef9c
commit c10761b1eb
2 changed files with 41 additions and 3 deletions
+1
View File
@@ -0,0 +1 @@
Screenshots: stored in ~/downloads/screenshots, with date time in the filename
+40 -3
View File
@@ -1,5 +1,6 @@
# Home-manager module: link centralized agent skills into Claude Code + Codex.
# Usage: add this flake as an input, then import this module in your home config.
# Home-manager module: link centralized agent skills into Claude Code, Codex,
# Pi and opencode. Usage: add this flake as an input, then import this module
# in your home config.
#
# inputs.agent-skills.url = "git+https://git.naps.pt/yolo/agent-skills.git";
# # in home.nix imports: inputs.agent-skills.homeModules.default
@@ -9,9 +10,20 @@
# recursive=true links each FILE individually, so machine-local skills can still
# live alongside the managed ones in the same dir (a whole-dir symlink would not).
{ agent-skills }:
{ config, lib, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.agentSkills;
# Pi and opencode have no `@file` imports in context files, so the shared
# fragments are concatenated into one AGENTS.md per tool.
concatMd =
name: files:
pkgs.writeText name (lib.concatMapStringsSep "\n" builtins.readFile files);
in
{
options.programs.agentSkills.machine = lib.mkOption {
@@ -65,6 +77,31 @@ in
# Entry files: machine-local sections + @imports of the fragments above.
".claude/CLAUDE.md".source = "${agent-skills}/entry/CLAUDE.md";
".codex/AGENTS.md".source = "${agent-skills}/entry/codex-AGENTS.md";
# Pi: skills need no wiring — pi reads ~/.agents/skills, linked above.
# Settings stay unmanaged: pi writes ~/.pi/agent/settings.json itself.
".pi/agent/AGENTS.md".source = concatMd "pi-AGENTS.md" [
"${agent-skills}/claude-md/machines/${cfg.machine}.md"
"${agent-skills}/claude-md/operating.md"
"${agent-skills}/claude-md/writing.md"
"${agent-skills}/claude-md/code-comments.md"
"${agent-skills}/claude-md/RTK.md"
];
# opencode auto-loads skills from ~/.claude/skills and ~/.agents/skills,
# so only the rules file and commands need linking here.
".config/opencode/AGENTS.md".source = concatMd "opencode-AGENTS.md" [
"${agent-skills}/claude-md/opencode-header.md"
"${agent-skills}/claude-md/machines/${cfg.machine}.md"
"${agent-skills}/claude-md/operating.md"
"${agent-skills}/claude-md/writing.md"
"${agent-skills}/claude-md/code-comments.md"
"${agent-skills}/claude-md/RTK.md"
];
".config/opencode/commands" = {
source = "${agent-skills}/commands";
recursive = true;
};
};
}
# Hook wiring lives in ~/.claude/settings.json, which this module does not own.