mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 05:02:10 +00:00
pi-agent stack (#46)
* pi-agent stack * fix: hardcode pi binary path, set XDG env for npm npm prefix discovery fails in systemd and activation contexts because NPM_CONFIG_USERCONFIG and XDG_DATA_HOME are not set. Hardcode the known path ~/.local/share/npm/bin/pi instead.
This commit is contained in:
parent
e19ee2405e
commit
588d8b8d6a
4 changed files with 128 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
./mise.nix
|
||||
./migration.nix
|
||||
./nvim.nix
|
||||
./pi.nix
|
||||
./prompt.nix
|
||||
./skills.nix
|
||||
./scripts.nix
|
||||
|
|
|
|||
52
home/pi.nix
Normal file
52
home/pi.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
npmDir = "${config.xdg.dataHome}/npm";
|
||||
piBin = "${npmDir}/bin/pi";
|
||||
in
|
||||
lib.mkIf hostConfig.isLinux {
|
||||
# Install pi-coding-agent globally via npm at activation time.
|
||||
home.activation.installPiAgent = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
export PATH="${
|
||||
lib.makeBinPath [
|
||||
pkgs.nodejs_22
|
||||
pkgs.coreutils
|
||||
]
|
||||
}:$PATH"
|
||||
export NPM_CONFIG_USERCONFIG="${config.xdg.configHome}/npm/npmrc"
|
||||
export XDG_DATA_HOME="${config.xdg.dataHome}"
|
||||
export XDG_CACHE_HOME="${config.xdg.cacheHome}"
|
||||
|
||||
if [ ! -d "${npmDir}/lib/node_modules/@mariozechner/pi-coding-agent" ]; then
|
||||
npm install -g @mariozechner/pi-coding-agent 2>/dev/null || true
|
||||
fi
|
||||
'';
|
||||
|
||||
# Install Pi extensions at activation time:
|
||||
# - @e9n/pi-channels: Telegram/Slack bridge with RPC-based persistent sessions
|
||||
# - pi-schedule-prompt: cron/interval scheduled prompts
|
||||
# - pi-subagents: background task delegation with async execution
|
||||
home.activation.installPiExtensions = lib.hm.dag.entryAfter [ "installPiAgent" ] ''
|
||||
export PATH="${
|
||||
lib.makeBinPath [
|
||||
pkgs.nodejs_22
|
||||
pkgs.coreutils
|
||||
pkgs.git
|
||||
]
|
||||
}:$PATH"
|
||||
export NPM_CONFIG_USERCONFIG="${config.xdg.configHome}/npm/npmrc"
|
||||
export XDG_DATA_HOME="${config.xdg.dataHome}"
|
||||
export XDG_CACHE_HOME="${config.xdg.cacheHome}"
|
||||
|
||||
if [ -x "${piBin}" ]; then
|
||||
for pkg in "@e9n/pi-channels" "pi-schedule-prompt" "pi-subagents"; do
|
||||
"${piBin}" install "npm:$pkg" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue