fix: add Playwright Chromium libraries on Linux - #2171
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughLinux package selection now includes ChangesLinux library path configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mesa DescriptionTL;DRFixes Playwright Chromium launch issues on Linux by installing What changed?
Root cause
ImpactManaged Linux environments including Kyber, Pod, generic Ubuntu, and Matic can resolve the NSPR and NSS libraries when launching Playwright Chromium. Validation
A complete Linux activation derivation was not cross-built locally because this host is Description generated by Mesa. Update settings |
|
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
|
|
||
| # Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar) | ||
| export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | ||
| export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.nspr}/lib:${pkgs.nss}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" |
There was a problem hiding this comment.
Likely-insufficient library set for Playwright Chromium (latent)
Adding nspr and nss here resolves the immediate libnspr4.so / libnss3.so errors called out in the PR description, but Playwright's downloaded Chromium binary usually pulls in additional runtime deps that are still missing from this LD_LIBRARY_PATH:
libatk-1.0.so.0(atk)libatk-bridge-2.0.so.0(at-spi2-atk)libcups.so.2(cups)libdbus-1.so.3(dbus)libdrm.so.2(libdrm)libgbm.so.1(mesa)libxkbcommon.so.0(libxkbcommon)libgtk-3.so.0(gtk3, headed mode only)
Once Chromium loads NSS successfully it will typically fail on the next missing library. You can verify with ldd node_modules/playwright-core/.local-browsers/chromium-*/chrome-linux/chrome | grep 'not found' on a Linux host.
Cleaner alternative: pkgs.playwright-driver.browsers bundles a working Chromium with all system deps and is usually what nixpkgs users reach for. If you want to keep the LD_LIBRARY_PATH approach, add the packages above so the fix is complete for typical launch() / page.goto flows.
The same comment applies to programs/bash/default.nix:124, programs/zsh/default.nix:54, and programs/fish/default.nix:33.
Summary
nsprandnssin the shared Linux Home Manager package setLD_LIBRARY_PATHin Bash, Zsh, and FishRoot cause
playwright-chromiumdownloads a foreign Chromium binary, but the existing Linux native-library configuration only covered the libraries required by Bun-installed Node addons. Chromium therefore could not resolvelibnspr4.soand would subsequently have failed on NSS.Impact
Managed Linux environments including Kyber, Pod, generic Ubuntu, and Matic can resolve the NSPR and NSS libraries when launching Playwright Chromium.
Validation
make nix-format-checkmake shell-test— 1,725 ShellSpec examples and 420 Fish tests passedx86_64-linuxHome Manager package sets for Kyber, Pod, generic Ubuntu, and Matic and confirmed both packages are presentA complete Linux activation derivation was not cross-built locally because this host is
aarch64-darwinand the existingobsidian-headlesswrapper requires anx86_64-linuxbuilder; the affected Linux package and shell options evaluated successfully.Summary by cubic
Fix Playwright Chromium startup on Linux by installing
nsprandnssand exporting their libs in shell configs. Managed Linux environments can now runplaywright-chromiumwithout NSPR/NSS errors.nsprandnssto the shared Linux Home Manager package set.LD_LIBRARY_PATHfor Bash, Zsh, and Fish.Written for commit cc2f938. Summary will update on new commits.