fix agent-browser (#38)
Some checks are pending
quality / changes (push) Waiting to run
quality / Flake Check (push) Blocked by required conditions
quality / Nix Format Check (push) Blocked by required conditions
quality / Deploy netty (push) Blocked by required conditions

This commit is contained in:
Hari 2026-04-02 00:42:58 -04:00 committed by GitHub
parent 8c78cf18e1
commit 029ad0af21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -12,7 +12,10 @@ lib.mkIf (!hostConfig.isDarwin) {
args = "--no-sandbox,--disable-gpu,--disable-dev-shm-usage"; args = "--no-sandbox,--disable-gpu,--disable-dev-shm-usage";
}; };
# Install agent-browser globally via npm at activation time # Install agent-browser globally via npm at activation time.
# npm's postinstall symlinks the glibc binary, which fails on NixOS
# (no /lib64/ld-linux-x86-64.so.2). Re-point the symlink at the
# statically-linked musl binary that works everywhere.
home.activation.installAgentBrowser = lib.hm.dag.entryAfter [ "writeBoundary" ] '' home.activation.installAgentBrowser = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
export PATH="${ export PATH="${
lib.makeBinPath [ lib.makeBinPath [
@ -21,9 +24,18 @@ lib.mkIf (!hostConfig.isDarwin) {
] ]
}:$PATH" }:$PATH"
npm_bin="$(npm prefix -g 2>/dev/null)/bin" npm_prefix="$(npm prefix -g 2>/dev/null)"
if [ ! -x "$npm_bin/agent-browser" ]; then npm_bin="$npm_prefix/bin"
pkg_bin="$npm_prefix/lib/node_modules/agent-browser/bin"
if [ ! -e "$pkg_bin/agent-browser-linux-musl-x64" ]; then
npm install -g agent-browser 2>/dev/null || true npm install -g agent-browser 2>/dev/null || true
fi fi
# Fix: replace glibc symlink with statically-linked musl binary
if [ -e "$pkg_bin/agent-browser-linux-musl-x64" ]; then
chmod +x "$pkg_bin/agent-browser-linux-musl-x64" 2>/dev/null || true
ln -sf "$pkg_bin/agent-browser-linux-musl-x64" "$npm_bin/agent-browser"
fi
''; '';
} }

View file

@ -105,6 +105,10 @@ in
services.journald.extraConfig = "MaxRetainedFileSec=1week"; services.journald.extraConfig = "MaxRetainedFileSec=1week";
# Provide /lib64/ld-linux-x86-64.so.2 so unpatched binaries
# from npm, cargo-install, etc. can run without patchelf.
programs.nix-ld.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
environment.systemPackages = packageSets.extras ++ [ environment.systemPackages = packageSets.extras ++ [