{ config, lib, ... }: # Pi, a terminal coding agent, for the primary user, configured through # home-manager, which ships the package and manages ~/.pi/agent. # The login credential is left unmanaged, so it survives rebuilds. let cfg = config.modules.pi; user = config.user.name; in { options.modules.pi.enable = lib.mkEnableOption '' Pi, a terminal coding agent, configured via home-manager. Pins the provider to Anthropic and the model to Opus so Pi runs the same model as Claude Code, and disables analytics. Authentication reuses an existing Claude subscription and is deliberately left unmanaged, so no credential enters the repo and re-auth survives rebuilds''; config = lib.mkIf cfg.enable { home-manager.users.${user}.programs.pi-coding-agent = { enable = true; # settings.json is the only file here Pi writes at runtime, and only its # analytics keys. Disabling analytics removes that write, so freezing the # file never fights Pi's self-modification, which targets other paths. settings = { defaultProvider = "anthropic"; # Pi's catalogue id for Opus. defaultModel = "claude-opus-4-8"; enableAnalytics = false; }; }; }; }