mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 07:04:47 +00:00
fix agent-browser
This commit is contained in:
parent
8c78cf18e1
commit
738856c15f
2 changed files with 19 additions and 3 deletions
|
|
@ -12,7 +12,10 @@ lib.mkIf (!hostConfig.isDarwin) {
|
|||
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" ] ''
|
||||
export PATH="${
|
||||
lib.makeBinPath [
|
||||
|
|
@ -21,9 +24,18 @@ lib.mkIf (!hostConfig.isDarwin) {
|
|||
]
|
||||
}:$PATH"
|
||||
|
||||
npm_bin="$(npm prefix -g 2>/dev/null)/bin"
|
||||
if [ ! -x "$npm_bin/agent-browser" ]; then
|
||||
npm_prefix="$(npm prefix -g 2>/dev/null)"
|
||||
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
|
||||
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
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ in
|
|||
|
||||
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;
|
||||
|
||||
environment.systemPackages = packageSets.extras ++ [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue