fix(nix): pin playwright to nixpkgs version

Playwright doesn't play that nice with NixOS because it downloads binaries that require libs that aren't always available. Nix has a special package with playwright browsers.

We don't use the latest features of Playwright, so lagging behind is fine and it limits the downloads required.
This commit is contained in:
Wout Mertens
2024-04-24 11:55:38 +02:00
parent 55d518e0f1
commit 23b70804ec
5 changed files with 54 additions and 23 deletions

2
.envrc
View File

@@ -1,3 +1,3 @@
# shellcheck shell=bash
use flake
PATH_add ./node_modules/.bin
watch_file rust-toolchain

14
flake.lock generated
View File

@@ -20,16 +20,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1709128929,
"narHash": "sha256-GWrv9a+AgGhG4/eI/CyVVIIygia7cEy68Huv3P8oyaw=",
"lastModified": 1713714899,
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c8e74c2f83fe12b4e5a8bd1abbc090575b0f7611",
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@@ -62,11 +62,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1709172595,
"narHash": "sha256-0oYeE5VkhnPA7YBl+0Utq2cYoHcfsEhSGwraCa27Vs8=",
"lastModified": 1713924823,
"narHash": "sha256-kOeyS3GFwgnKvzuBMmFqEAX0xwZ7Nj4/5tXuvpZ0d4U=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "72fa0217f76020ad3aeb2dd9dd72490905b23b6f",
"rev": "8a2edac3ae926a2a6ce60f4595dcc4540fc8cad4",
"type": "github"
},
"original": {

View File

@@ -1,6 +1,16 @@
# This is a Nix configuration file. It is used to define the environment
# for the project. It is a declarative way to define the dependencies.
# It is used by the `nix develop` command to create a development environment
# with all the dependencies needed for the project.
# To update the dependencies, run `nix flake update`.
# Note: keep the playwright version in package.json syncpack the same as the nix version
# We don't need to have the latest playwright all the time so not having to download
# all the browsers on every version bump is a good thing.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
@@ -23,6 +33,9 @@
nodejs_20
corepack_20
# Playwright for the end-to-end tests
playwright-driver.browsers
# Qwik optimizer deps
wasm-pack
# Provides rustc and cargo
@@ -34,6 +47,17 @@
targets = [ "wasm32-unknown-unknown" ];
})
];
# https://github.com/microsoft/playwright/issues/5501
shellHook = ''
export PATH=$PWD/node_modules/.bin:$PATH
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
pwNixVersion=${pkgs.playwright-driver.version}
pwNpmVersion=$(${pkgs.jq}/bin/jq -r .version node_modules/@playwright/test/package.json 2>/dev/null)
if [ -n "$pwNpmVersion" ] && [ "$pwNpmVersion" != "$pwNixVersion" ]; then
echo "!!! Playwright version mismatch: $pwNpmVersion (nodejs) != $pwNixVersion (nix). Please fix." >&2
fi
'';
};
};
in

View File

@@ -21,6 +21,13 @@
"!local"
],
"pinVersion": "workspace:^"
},
{
"label": "Playwright should have the same version as in flake.nix",
"dependencies": [
"@playwright/test"
],
"pinVersion": "1.40.0"
}
],
"semverGroups": [
@@ -67,7 +74,7 @@
"@napi-rs/triples": "^1.2.0",
"@node-rs/helper": "^1.5.0",
"@octokit/action": "6.0.7",
"@playwright/test": "^1.42.1",
"@playwright/test": "1.40.0",
"@types/brotli": "^1.3.4",
"@types/bun": "^1.1.0",
"@types/cross-spawn": "^6.0.6",

26
pnpm-lock.yaml generated
View File

@@ -59,8 +59,8 @@ importers:
specifier: 6.0.7
version: 6.0.7
'@playwright/test':
specifier: ^1.42.1
version: 1.42.1
specifier: 1.40.0
version: 1.40.0
'@types/brotli':
specifier: ^1.3.4
version: 1.3.4
@@ -2727,8 +2727,8 @@ packages:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
'@playwright/test@1.42.1':
resolution: {integrity: sha512-Gq9rmS54mjBL/7/MvBaNOBwbfnh7beHvS6oS4srqXFcQHpQCV1+c8JXWE8VLPyRDhgS3H8x8A7hztqI9VnwrAQ==}
'@playwright/test@1.40.0':
resolution: {integrity: sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==}
engines: {node: '>=16'}
hasBin: true
@@ -7680,13 +7680,13 @@ packages:
pkg-types@1.0.3:
resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==}
playwright-core@1.42.1:
resolution: {integrity: sha512-mxz6zclokgrke9p1vtdy/COWBH+eOZgYUVVU34C73M+4j4HLlQJHtfcqiqqxpP0o8HhMkflvfbquLX5dg6wlfA==}
playwright-core@1.40.0:
resolution: {integrity: sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==}
engines: {node: '>=16'}
hasBin: true
playwright@1.42.1:
resolution: {integrity: sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==}
playwright@1.40.0:
resolution: {integrity: sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==}
engines: {node: '>=16'}
hasBin: true
@@ -11665,9 +11665,9 @@ snapshots:
'@pkgjs/parseargs@0.11.0':
optional: true
'@playwright/test@1.42.1':
'@playwright/test@1.40.0':
dependencies:
playwright: 1.42.1
playwright: 1.40.0
'@pnpm/config.env-replace@1.1.0': {}
@@ -17735,11 +17735,11 @@ snapshots:
mlly: 1.6.1
pathe: 1.1.2
playwright-core@1.42.1: {}
playwright-core@1.40.0: {}
playwright@1.42.1:
playwright@1.40.0:
dependencies:
playwright-core: 1.42.1
playwright-core: 1.40.0
optionalDependencies:
fsevents: 2.3.2