Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf

[*.sh]
indent_style = tab
tab_width = 4

[*.nix]
indent_style = space
indent_size = 2
22 changes: 13 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
{
description = "A flake for playwright";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
packages = {
playwright-test = pkgs.callPackage ./playwright-test/wrapped.nix { };
playwright-driver = pkgs.callPackage ./playwright-driver { };
playwright-test = (pkgs.callPackage ./playwright-driver/driver.nix { }).playwright-test;
playwright-driver = (pkgs.callPackage ./playwright-driver/driver.nix { }).playwright-core;
};

devShells.default = pkgs.mkShell {
Expand Down
38 changes: 38 additions & 0 deletions playwright-driver/browsers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"comment": "This file is kept up to date via update.sh",
"browsers": {
"chromium": {
"revision": "1208",
"browserVersion": "145.0.7632.6",
"title": "Chrome for Testing"
},
"chromium-headless-shell": {
"revision": "1208",
"browserVersion": "145.0.7632.6",
"title": "Chrome Headless Shell"
},
"firefox": {
"revision": "1509",
"browserVersion": "146.0.1",
"title": "Firefox"
},
"webkit": {
"revision": "2248",
"revisionOverrides": {
"debian11-x64": "2105",
"debian11-arm64": "2105",
"ubuntu20.04-x64": "2092",
"ubuntu20.04-arm64": "2092"
},
"browserVersion": "26.0",
"title": "WebKit"
},
"ffmpeg": {
"revision": "1011",
"revisionOverrides": {
"mac12": "1010",
"mac12-arm64": "1010"
}
}
}
}
83 changes: 83 additions & 0 deletions playwright-driver/chromium-headless-shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
fetchzip,
revision,
suffix,
system,
throwSystem,
stdenv,
autoPatchelfHook,
patchelfUnstable,

alsa-lib,
at-spi2-atk,
expat,
glib,
libXcomposite,
libXdamage,
libXfixes,
libXrandr,
libgbm,
libgcc,
libxkbcommon,
nspr,
nss,
...
}:
let
linux = stdenv.mkDerivation {
name = "playwright-chromium-headless-shell";
src = fetchzip {
url = "https://cdn.playwright.dev/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
stripRoot = false;
hash =
{
x86_64-linux = "sha256-/xskLzTc9tTZmu1lwkMpjV3QV7XjP92D/7zRcFuVWT8=";
aarch64-linux = "sha256-jckH5+eGJ4BhH1NAa5LIgf3/salKLAHW9XUOo5gob4c=";
}
.${system} or throwSystem;
};

nativeBuildInputs = [
autoPatchelfHook
patchelfUnstable
];

buildInputs = [
alsa-lib
at-spi2-atk
expat
glib
libXcomposite
libXdamage
libXfixes
libXrandr
libgbm
libgcc.lib
libxkbcommon
nspr
nss
];

buildPhase = ''
cp -R . $out
'';
};

darwin = fetchzip {
url = "https://cdn.playwright.dev/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
stripRoot = false;
hash =
{
x86_64-darwin = "sha256-bgU7lZhp9XUFfGu58pFdZyhXho3Jiy4MjljR+yk0M1c=";
aarch64-darwin = "sha256-45DjMIu0t7IEYdXOmIqpV/1/MKdEfx/8T7DWagh6Zhc=";
}
.${system} or throwSystem;
};
in
{
x86_64-linux = linux;
aarch64-linux = linux;
x86_64-darwin = darwin;
aarch64-darwin = darwin;
}
.${system} or throwSystem
130 changes: 130 additions & 0 deletions playwright-driver/chromium.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
runCommand,
makeWrapper,
fontconfig_file,
chromium,
fetchzip,
revision,
suffix,
system,
throwSystem,
lib,
alsa-lib,
at-spi2-atk,
atk,
autoPatchelfHook,
cairo,
cups,
dbus,
expat,
glib,
gobject-introspection,
libGL,
libgbm,
libgcc,
libxkbcommon,
nspr,
nss,
pango,
patchelf,
pciutils,
stdenv,
systemd,
vulkan-loader,
libX11,
libXcomposite,
libXdamage,
libXext,
libXfixes,
libXrandr,
libxcb,
...
}:
let
chromium-linux = stdenv.mkDerivation {
name = "playwright-chromium";
src = fetchzip {
url = "https://cdn.playwright.dev/builds/chromium/${revision}/chromium-${suffix}.zip";
hash =
{
x86_64-linux = "sha256-dJSO05xOzlSl/EwOWNQCeuSb+lhUU6NlGBnRu59irnM=";
aarch64-linux = "sha256-9DFLCPuc9WZjYLzlRW+Df2pb+mViPK3/IOkkUozELsw=";
}
.${system} or throwSystem;
};

nativeBuildInputs = [
autoPatchelfHook
patchelf
makeWrapper
];
buildInputs = [
alsa-lib
at-spi2-atk
atk
cairo
cups
dbus
expat
glib
gobject-introspection
libgbm
libgcc
libxkbcommon
nspr
nss
pango
stdenv.cc.cc.lib
systemd
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXrandr
libxcb
];

installPhase = ''
runHook preInstall

mkdir -p $out/chrome-linux64
cp -R . $out/chrome-linux64

wrapProgram $out/chrome-linux64/chrome \
--set-default SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt \
--set-default FONTCONFIG_FILE ${fontconfig_file}

runHook postInstall
'';

appendRunpaths = lib.makeLibraryPath [
libGL
vulkan-loader
pciutils
];

postFixup = ''
# replace bundled vulkan-loader since we are also already adding our own to RPATH
rm "$out/chrome-linux64/libvulkan.so.1"
ln -s -t "$out/chrome-linux64" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
'';
};
chromium-darwin = fetchzip {
url = "https://cdn.playwright.dev/builds/chromium/${revision}/chromium-${suffix}.zip";
stripRoot = false;
hash =
{
x86_64-darwin = "sha256-vQuBHM0jkk6S/Gco/bBqSPJqXi/CJt/+nkbGtFNpgwk=";
aarch64-darwin = "sha256-qXdgHeBS5IFIa4hZVmjq0+31v/uDPXHyc4aH7Wn2E7E=";
}
.${system} or throwSystem;
};
in
{
x86_64-linux = chromium-linux;
aarch64-linux = chromium-linux;
x86_64-darwin = chromium-darwin;
aarch64-darwin = chromium-darwin;
}
.${system} or throwSystem
Loading