diff options
Diffstat (limited to 'modules/development/pi-coding-agent/default.nix')
| -rw-r--r-- | modules/development/pi-coding-agent/default.nix | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/modules/development/pi-coding-agent/default.nix b/modules/development/pi-coding-agent/default.nix new file mode 100644 index 0000000..1b27012 --- /dev/null +++ b/modules/development/pi-coding-agent/default.nix @@ -0,0 +1,112 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.development.pi-coding-agent; + configDir = "${config.xdg.configHome}/pi"; +in +{ + options.development.pi-coding-agent = { + enable = lib.mkEnableOption "Pi Coding Agent"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.pi; + description = "The Pi Coding Agent package to use."; + }; + }; + + config = lib.mkIf cfg.enable { + home.sessionVariables = { + PI_CODING_AGENT_DIR = configDir; + }; + + home.file = { + "${configDir}/skills".source = ./skills; + "${configDir}/prompts".source = ./prompts; + "${configDir}/agents".source = ./agents; + }; + + programs.pi-coding-agent = { + enable = true; + inherit configDir; + keybindings = { + "tui.editor.cursorUp" = [ + "up" + "ctrl+p" + ]; + + "tui.editor.cursorDown" = [ + "down" + "ctrl+n" + ]; + + "tui.editor.deleteWordBackward" = [ + "ctrl+w" + "alt+backspace" + ]; + + "tui.editor.historyPrevious" = "ctrl+up"; + }; + + settings = { + defaultTools = [ + "read" + "bash" + "edit" + "write" + "grep" + "find" + "ls" + ]; + + defaultProjectTrust = "ask"; + + compaction = { + enabled = true; + reserveTokens = 16384; + keepRecentTokens = 20000; + }; + + retry = { + enabled = true; + maxRetries = 3; + baseDelayMs = 2000; + maxAgentDelayMs = 60000; + }; + + theme = "dark"; + + packages = [ + "npm:@termdraw/pi" + "npm:pi-mcp-adapter" + "npm:@henryqw/pi-subagent" + ]; + + skills = [ + "${configDir}/skills" + ]; + + prompts = [ + "${configDir}/prompts" + ]; + + themes = [ + "${configDir}/themes" + ]; + + enableSkillCommands = true; + + context = ./CONTEXT.md; + }; + + extraPackages = with pkgs; [ + nodejs + bun + ]; + }; + }; +} |
