feat(pi): install Herdr integration declaratively

This commit is contained in:
2026-07-31 22:48:43 -04:00
parent 6422bb96f2
commit 36d7a53029

View File

@@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
# Pi, a terminal coding agent, for the primary user, configured through # Pi, a terminal coding agent, for the primary user, configured through
@@ -10,6 +11,26 @@ let
cfg = config.modules.agents.pi; cfg = config.modules.agents.pi;
user = config.user.name; user = config.user.name;
piDir = "${config.users.users.${user}.home}/.pi/agent"; piDir = "${config.users.users.${user}.home}/.pi/agent";
herdrPiIntegration = pkgs.stdenvNoCC.mkDerivation {
name = "herdr-pi-integration";
nativeBuildInputs = [ pkgs.herdr ];
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $TMPDIR/home/.pi/agent/extensions
HOME=$TMPDIR/home herdr integration install pi
mkdir -p $out
cp $TMPDIR/home/.pi/agent/extensions/herdr-agent-state.ts $out/herdr-agent-state.ts
'';
};
piExtensions = pkgs.stdenvNoCC.mkDerivation {
name = "pi-extensions";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cp -R ${./extensions}/. $out/
cp ${herdrPiIntegration}/herdr-agent-state.ts $out/herdr-agent-state.ts
'';
};
in in
{ {
options.modules.agents.pi.enable = lib.mkEnableOption '' options.modules.agents.pi.enable = lib.mkEnableOption ''
@@ -36,7 +57,7 @@ in
"${piDir}/settings.json".force = true; "${piDir}/settings.json".force = true;
"${piDir}/extensions" = { "${piDir}/extensions" = {
source = ./extensions; source = piExtensions;
recursive = true; recursive = true;
}; };