Open altsalt opened 5 months ago
Not entirely related, but one can get Playwright working on NixOS by adding the following block to /package.json
(where the version matches the one in nixpkgs):
"pnpm": {
"overrides": {
"@playwright/test": "1.38.0",
"playwright": "1.38.0"
}
}
with this shell.nix
file:
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs_20
(corepack.override { nodejs = nodejs_20; })
biome
playwright-driver.browsers
];
shellHook = ''
export BIOME_BINARY="${pkgs.biome}/bin/biome"
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
'';
}
References:
How does this work, do I just add @playwright/browser-chromium
to the package.json
?
Also, do we have to pin @playwright/test
as well?
I'm not sure tbh, still new to playwright. Just updated the pnpm override to "1.40.0" for NixOS 24.05 which is the "playwright-driver" version, despite playwright 1.42.0 being in the repo.
While the version of playwright is pinned, the downloaded browsers may differ. In part this is because some systems can't use the auto-installed versions, thus falling back to what is local.