nix/home/agent-browser.nix
Harivansh Rathi 8cf74b95be fix agent-browser PATH: add npm global bin to zsh path
- Add npm global bin dir to zsh path array so agent-browser
  (and other npm -g binaries) are found in interactive shells
- Fix activation check to look for the binary at the actual npm
  prefix path instead of relying on command -v with wrong PATH
2026-04-02 00:11:18 -04:00

29 lines
771 B
Nix

{
config,
lib,
pkgs,
hostConfig,
...
}:
lib.mkIf (!hostConfig.isDarwin) {
# agent-browser user-level config: point at nix chromium, run headless
home.file.".agent-browser/config.json".text = builtins.toJSON {
executablePath = "${pkgs.chromium}/bin/chromium";
args = "--no-sandbox,--disable-gpu,--disable-dev-shm-usage";
};
# Install agent-browser globally via npm at activation time
home.activation.installAgentBrowser = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
export PATH="${
lib.makeBinPath [
pkgs.nodejs_22
pkgs.coreutils
]
}:$PATH"
npm_bin="$(npm prefix -g 2>/dev/null)/bin"
if [ ! -x "$npm_bin/agent-browser" ]; then
npm install -g agent-browser 2>/dev/null || true
fi
'';
}