mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
[24.11] playwright: 1.47.0 -> 1.50.1 (#382009)
This commit is contained in:
commit
b5a00ebfb3
11 changed files with 406 additions and 215 deletions
|
@ -25,19 +25,20 @@ import ./make-test-python.nix (
|
|||
from playwright.sync_api import expect
|
||||
|
||||
browsers = {
|
||||
"chromium": ["--headless", "--disable-gpu"],
|
||||
"firefox": [],
|
||||
"webkit": []
|
||||
"chromium": {'args': ["--headless", "--disable-gpu"], 'channel': 'chromium'},
|
||||
"firefox": {},
|
||||
"webkit": {}
|
||||
}
|
||||
if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys():
|
||||
print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>")
|
||||
sys.exit(1)
|
||||
browser_name = sys.argv[1]
|
||||
url = sys.argv[2]
|
||||
browser_args = browsers.get(browser_name)
|
||||
print(f"Running test on {browser_name} {' '.join(browser_args)}")
|
||||
browser_kwargs = browsers.get(browser_name)
|
||||
args = ' '.join(browser_kwargs.get('args', []))
|
||||
print(f"Running test on {browser_name} {args}")
|
||||
with sync_playwright() as p:
|
||||
browser = getattr(p, browser_name).launch(args=browser_args)
|
||||
browser = getattr(p, browser_name).launch(**browser_kwargs)
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
page.goto(url)
|
||||
|
|
|
@ -22,15 +22,15 @@ in
|
|||
buildPythonPackage rec {
|
||||
pname = "playwright";
|
||||
# run ./pkgs/development/python-modules/playwright/update.sh to update
|
||||
version = "1.47.0";
|
||||
version = "1.50.0";
|
||||
pyproject = true;
|
||||
disabled = pythonOlder "3.7";
|
||||
disabled = pythonOlder "3.9";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "microsoft";
|
||||
repo = "playwright-python";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-C/spH54hhLI0Egs2jjTjQ5BH1pIw1syrfSyUvVQRoKM=";
|
||||
hash = "sha256-g32QwEA4Ofzh7gVEsC++uA/XqT1eIrUH+fQi15SRxko=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
|
@ -51,18 +51,13 @@ buildPythonPackage rec {
|
|||
git config --global user.name "nixpkgs"
|
||||
git commit -m "workaround setuptools-scm"
|
||||
|
||||
substituteInPlace setup.py \
|
||||
--replace "setuptools-scm==8.1.0" "setuptools-scm" \
|
||||
--replace-fail "wheel==0.42.0" "wheel"
|
||||
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace 'requires = ["setuptools==68.2.2", "setuptools-scm==8.1.0", "wheel==0.42.0", "auditwheel==5.4.0"]' \
|
||||
'requires = ["setuptools", "setuptools-scm", "wheel"]'
|
||||
--replace-fail 'requires = ["setuptools==75.6.0", "setuptools-scm==8.1.0", "wheel==0.45.1", "auditwheel==6.2.0"]' \
|
||||
'requires = ["setuptools", "setuptools-scm", "wheel"]'
|
||||
|
||||
# Skip trying to download and extract the driver.
|
||||
# setup.py downloads and extracts the driver.
|
||||
# This is done manually in postInstall instead.
|
||||
substituteInPlace setup.py \
|
||||
--replace "self._download_and_extract_local_driver(base_wheel_bundles)" ""
|
||||
rm setup.py
|
||||
|
||||
# Set the correct driver path with the help of a patch in patches
|
||||
substituteInPlace playwright/_impl/_driver.py \
|
||||
|
@ -105,6 +100,9 @@ buildPythonPackage rec {
|
|||
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
inherit (nixosTests) playwright-python;
|
||||
};
|
||||
# Package and playwright driver versions are tightly coupled.
|
||||
# Use the update script to ensure synchronized updates.
|
||||
skipBulkUpdate = true;
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ index 22b53b8..2d86626 100644
|
|||
--- a/playwright/_impl/_driver.py
|
||||
+++ b/playwright/_impl/_driver.py
|
||||
@@ -23,14 +23,7 @@ from playwright._repo_version import version
|
||||
|
||||
|
||||
|
||||
|
||||
def compute_driver_executable() -> Tuple[str, str]:
|
||||
- driver_path = Path(inspect.getfile(playwright)).parent / "driver"
|
||||
- cli_path = str(driver_path / "package" / "cli.js")
|
||||
|
@ -15,36 +15,6 @@ index 22b53b8..2d86626 100644
|
|||
- )
|
||||
- return (os.getenv("PLAYWRIGHT_NODEJS_PATH", str(driver_path / "node")), cli_path)
|
||||
+ return "@node@", "@driver@"
|
||||
|
||||
|
||||
|
||||
|
||||
def get_driver_env() -> dict:
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 8709e52..59784dd 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -141,25 +141,8 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand):
|
||||
base_wheel_location: str = glob.glob(os.path.join(self.dist_dir, "*.whl"))[0]
|
||||
without_platform = base_wheel_location[:-7]
|
||||
for wheel_bundle in wheels:
|
||||
- download_driver(wheel_bundle["zip_name"])
|
||||
- zip_file = (
|
||||
- f"driver/playwright-{driver_version}-{wheel_bundle['zip_name']}.zip"
|
||||
- )
|
||||
- with zipfile.ZipFile(zip_file, "r") as zip:
|
||||
- extractall(zip, f"driver/{wheel_bundle['zip_name']}")
|
||||
wheel_location = without_platform + wheel_bundle["wheel"]
|
||||
shutil.copy(base_wheel_location, wheel_location)
|
||||
- with zipfile.ZipFile(wheel_location, "a") as zip:
|
||||
- driver_root = os.path.abspath(f"driver/{wheel_bundle['zip_name']}")
|
||||
- for dir_path, _, files in os.walk(driver_root):
|
||||
- for file in files:
|
||||
- from_path = os.path.join(dir_path, file)
|
||||
- to_path = os.path.relpath(from_path, driver_root)
|
||||
- zip.write(from_path, f"playwright/driver/{to_path}")
|
||||
- zip.writestr(
|
||||
- "playwright/driver/README.md",
|
||||
- f"{wheel_bundle['wheel']} driver package",
|
||||
- )
|
||||
os.remove(base_wheel_location)
|
||||
if InWheel:
|
||||
for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused common-updater-scripts jq prefetch-npm-deps unzip
|
||||
#!nix-shell -i bash -p curl gnused common-updater-scripts jq prefetch-npm-deps unzip nix-prefetch
|
||||
set -euo pipefail
|
||||
|
||||
root="$(dirname "$(readlink -f "$0")")"
|
||||
|
@ -30,18 +30,43 @@ replace_sha() {
|
|||
}
|
||||
|
||||
prefetch_browser() {
|
||||
nix store prefetch-file --json --hash-type sha256 --unpack "$1" | jq -r .hash
|
||||
# nix-prefetch is used to obtain sha with `stripRoot = false`
|
||||
# doesn't work on macOS https://github.com/msteen/nix-prefetch/issues/53
|
||||
nix-prefetch -q "{ stdenv, fetchzip }: stdenv.mkDerivation rec { name=\"browser\"; src = fetchzip { url = \"$1\"; stripRoot = $2; }; }"
|
||||
}
|
||||
|
||||
update_browser() {
|
||||
name="$1"
|
||||
suffix="$2"
|
||||
arm64_suffix="${3:-$2-arm64}"
|
||||
revision="$(jq -r ".browsers.$name.revision" "$playwright_dir/browsers.json")"
|
||||
replace_sha "$playwright_dir/$name.nix" "x86_64-linux" \
|
||||
"$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$suffix.zip")"
|
||||
replace_sha "$playwright_dir/$name.nix" "aarch64-linux" \
|
||||
"$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$arm64_suffix.zip")"
|
||||
platform="$2"
|
||||
stripRoot="false"
|
||||
if [ "$platform" = "darwin" ]; then
|
||||
if [ "$name" = "webkit" ]; then
|
||||
suffix="mac-14"
|
||||
else
|
||||
suffix="mac"
|
||||
fi
|
||||
else
|
||||
if [ "$name" = "ffmpeg" ] || [ "$name" = "chromium-headless-shell" ]; then
|
||||
suffix="linux"
|
||||
elif [ "$name" = "firefox" ]; then
|
||||
stripRoot="true"
|
||||
suffix="ubuntu-22.04"
|
||||
else
|
||||
suffix="ubuntu-22.04"
|
||||
fi
|
||||
fi
|
||||
aarch64_suffix="$suffix-arm64"
|
||||
if [ "$name" = "chromium-headless-shell" ]; then
|
||||
buildname="chromium";
|
||||
else
|
||||
buildname="$name"
|
||||
fi
|
||||
|
||||
revision="$(jq -r ".browsers[\"$buildname\"].revision" "$playwright_dir/browsers.json")"
|
||||
replace_sha "$playwright_dir/$name.nix" "x86_64-$platform" \
|
||||
"$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$suffix.zip" $stripRoot)"
|
||||
replace_sha "$playwright_dir/$name.nix" "aarch64-$platform" \
|
||||
"$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$aarch64_suffix.zip" $stripRoot)"
|
||||
}
|
||||
|
||||
curl -fsSl \
|
||||
|
@ -57,11 +82,16 @@ curl -fsSl \
|
|||
' > "$playwright_dir/browsers.json"
|
||||
|
||||
# We currently use Chromium from nixpkgs, so we don't need to download it here
|
||||
# Likewise, darwin can be ignored here atm as we are using an impure install anyway.
|
||||
update_browser "firefox" "ubuntu-22.04"
|
||||
update_browser "webkit" "ubuntu-22.04"
|
||||
update_browser "chromium-headless-shell" "linux"
|
||||
update_browser "firefox" "linux"
|
||||
update_browser "webkit" "linux"
|
||||
update_browser "ffmpeg" "linux"
|
||||
|
||||
update_browser "chromium" "darwin"
|
||||
update_browser "chromium-headless-shell" "darwin"
|
||||
update_browser "firefox" "darwin"
|
||||
update_browser "webkit" "darwin"
|
||||
update_browser "ffmpeg" "darwin"
|
||||
|
||||
# Update package-lock.json files for all npm deps that are built in playwright
|
||||
|
||||
|
|
|
@ -2,27 +2,35 @@
|
|||
"comment": "This file is kept up to date via update.sh",
|
||||
"browsers": {
|
||||
"chromium": {
|
||||
"revision": "1134",
|
||||
"browserVersion": "129.0.6668.29"
|
||||
"revision": "1155",
|
||||
"browserVersion": "133.0.6943.16"
|
||||
},
|
||||
"firefox": {
|
||||
"revision": "1463",
|
||||
"browserVersion": "130.0"
|
||||
"revision": "1471",
|
||||
"browserVersion": "134.0"
|
||||
},
|
||||
"webkit": {
|
||||
"revision": "2070",
|
||||
"revision": "2123",
|
||||
"revisionOverrides": {
|
||||
"debian11-x64": "2105",
|
||||
"debian11-arm64": "2105",
|
||||
"mac10.14": "1446",
|
||||
"mac10.15": "1616",
|
||||
"mac11": "1816",
|
||||
"mac11-arm64": "1816",
|
||||
"mac12": "2009",
|
||||
"mac12-arm64": "2009"
|
||||
"mac12-arm64": "2009",
|
||||
"ubuntu20.04-x64": "2092",
|
||||
"ubuntu20.04-arm64": "2092"
|
||||
},
|
||||
"browserVersion": "18.0"
|
||||
"browserVersion": "18.2"
|
||||
},
|
||||
"ffmpeg": {
|
||||
"revision": "1010"
|
||||
"revision": "1011",
|
||||
"revisionOverrides": {
|
||||
"mac12": "1010",
|
||||
"mac12-arm64": "1010"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
81
pkgs/development/web/playwright/chromium-headless-shell.nix
Normal file
81
pkgs/development/web/playwright/chromium-headless-shell.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
fetchzip,
|
||||
revision,
|
||||
suffix,
|
||||
system,
|
||||
throwSystem,
|
||||
stdenv,
|
||||
autoPatchelfHook,
|
||||
patchelfUnstable,
|
||||
|
||||
alsa-lib,
|
||||
at-spi2-atk,
|
||||
glib,
|
||||
libXcomposite,
|
||||
libXdamage,
|
||||
libXfixes,
|
||||
libXrandr,
|
||||
libgcc,
|
||||
libxkbcommon,
|
||||
nspr,
|
||||
nss,
|
||||
mesa,
|
||||
...
|
||||
}:
|
||||
let
|
||||
linux = stdenv.mkDerivation {
|
||||
name = "playwright-chromium-headless-shell";
|
||||
src = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-UNLSiI9jWLev2YwqiXuoHwJfdB4teNhEfQjQRBEo8uY=";
|
||||
aarch64-linux = "sha256-aVGLcJHFER09frJdKsGW/pKPl5MXoXef2hy5WTA8rS4=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
patchelfUnstable
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
at-spi2-atk
|
||||
glib
|
||||
libXcomposite
|
||||
libXdamage
|
||||
libXfixes
|
||||
libXrandr
|
||||
mesa
|
||||
libgcc.lib
|
||||
libxkbcommon
|
||||
nspr
|
||||
nss
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
cp -R . $out
|
||||
'';
|
||||
};
|
||||
|
||||
darwin = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-darwin = "sha256-c26ubAgM9gQPaYqobQyS3Y7wvMUmmdpDlrYmZJrUgho=";
|
||||
aarch64-darwin = "sha256-XRFqlhVx+GuDxz/kDP8TtyPQfR0JbFD0qu5OSywGTX8=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
in
|
||||
{
|
||||
x86_64-linux = linux;
|
||||
aarch64-linux = linux;
|
||||
x86_64-darwin = darwin;
|
||||
aarch64-darwin = darwin;
|
||||
}
|
||||
.${system} or throwSystem
|
|
@ -3,22 +3,47 @@
|
|||
makeWrapper,
|
||||
fontconfig_file,
|
||||
chromium,
|
||||
fetchzip,
|
||||
revision,
|
||||
suffix,
|
||||
system,
|
||||
throwSystem,
|
||||
...
|
||||
}:
|
||||
runCommand "playwright-chromium"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
}
|
||||
''
|
||||
mkdir -p $out/chrome-linux
|
||||
let
|
||||
chromium-linux =
|
||||
runCommand "playwright-chromium"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
}
|
||||
''
|
||||
mkdir -p $out/chrome-linux
|
||||
|
||||
# See here for the Chrome options:
|
||||
# https://github.com/NixOS/nixpkgs/issues/136207#issuecomment-908637738
|
||||
# We add --disable-gpu to be able to run in gpu-less environments such
|
||||
# as headless nixos test vms.
|
||||
makeWrapper ${chromium}/bin/chromium $out/chrome-linux/chrome \
|
||||
--set-default SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt \
|
||||
--set-default FONTCONFIG_FILE ${fontconfig_file}
|
||||
''
|
||||
# See here for the Chrome options:
|
||||
# https://github.com/NixOS/nixpkgs/issues/136207#issuecomment-908637738
|
||||
# We add --disable-gpu to be able to run in gpu-less environments such
|
||||
# as headless nixos test vms.
|
||||
makeWrapper ${chromium}/bin/chromium $out/chrome-linux/chrome \
|
||||
--set-default SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt \
|
||||
--set-default FONTCONFIG_FILE ${fontconfig_file}
|
||||
'';
|
||||
chromium-darwin = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-${suffix}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-darwin = "sha256-seMHD+TmxrfgsN6sLN2Bp3WgAooDnlSxGN6CPw1Q790=";
|
||||
aarch64-darwin = "sha256-SsIRzxTIuf/mwsYvRM2mv8PzWQAAflxOyoK5TuyhMAU=";
|
||||
}
|
||||
.${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
|
||||
|
|
|
@ -27,13 +27,13 @@ let
|
|||
}
|
||||
.${system} or throwSystem;
|
||||
|
||||
version = "1.47.0";
|
||||
version = "1.50.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Microsoft";
|
||||
repo = "playwright";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-cKjVDy1wFo8NlF8v+8YBuQUF2OUYjCmv27uhEoVUrno=";
|
||||
hash = "sha256-s4lJRdsA4H+Uf9LjriZ6OimBl5A9Pf4fvhWDw2kOMkg=";
|
||||
};
|
||||
|
||||
babel-bundle = buildNpmPackage {
|
||||
|
@ -50,7 +50,7 @@ let
|
|||
pname = "expect-bundle";
|
||||
inherit version src;
|
||||
sourceRoot = "${src.name}/packages/playwright/bundles/expect";
|
||||
npmDepsHash = "sha256-qnFx/AQZtmxNFrrabfOpsWy6I64DFJf3sWrJzL1wfU4=";
|
||||
npmDepsHash = "sha256-KwxNqPefvPPHG4vbco2O4G8WlA7l33toJdfNWHMTDOQ=";
|
||||
dontNpmBuild = true;
|
||||
installPhase = ''
|
||||
cp -r . "$out"
|
||||
|
@ -60,7 +60,7 @@ let
|
|||
pname = "utils-bundle";
|
||||
inherit version src;
|
||||
sourceRoot = "${src.name}/packages/playwright/bundles/utils";
|
||||
npmDepsHash = "sha256-d+nE11x/493BexI70mVbnZFLQClU88sscbNwruXjx1M=";
|
||||
npmDepsHash = "sha256-tyk9bv1ethQSm8PKDpLthwsmqJugLIpsUOf9G8TOKRc=";
|
||||
dontNpmBuild = true;
|
||||
installPhase = ''
|
||||
cp -r . "$out"
|
||||
|
@ -70,7 +70,7 @@ let
|
|||
pname = "utils-bundle-core";
|
||||
inherit version src;
|
||||
sourceRoot = "${src.name}/packages/playwright-core/bundles/utils";
|
||||
npmDepsHash = "sha256-aktxEDQKxsDcInyjDKDuIu4zwtrAH0lRda/mP1IayPA=";
|
||||
npmDepsHash = "sha256-TarWFVp5JFCKZIvBUTohzzsFaLZHV79lN5+G9+rCP8Y=";
|
||||
dontNpmBuild = true;
|
||||
installPhase = ''
|
||||
cp -r . "$out"
|
||||
|
@ -92,7 +92,7 @@ let
|
|||
inherit version src;
|
||||
|
||||
sourceRoot = "${src.name}"; # update.sh depends on sourceRoot presence
|
||||
npmDepsHash = "sha256-FaDTJmIiaaOCvq6tARfiWX5IBTTNOJ/iVkRsO4D8aqc=";
|
||||
npmDepsHash = "sha256-RoKw3Ie41/4DsjCeqkMhKFyjDPuvMgxajZYZhRdiTuY=";
|
||||
|
||||
nativeBuildInputs = [ cacert ];
|
||||
|
||||
|
@ -159,15 +159,12 @@ let
|
|||
|
||||
passthru = {
|
||||
browsersJSON = (lib.importJSON ./browsers.json).browsers;
|
||||
browsers =
|
||||
{
|
||||
x86_64-linux = browsers-linux { };
|
||||
aarch64-linux = browsers-linux { };
|
||||
x86_64-darwin = browsers-mac;
|
||||
aarch64-darwin = browsers-mac;
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
browsers-chromium = browsers-linux { };
|
||||
browsers = browsers { };
|
||||
browsers-chromium = browsers {
|
||||
withFirefox = false;
|
||||
withWebkit = false;
|
||||
withChromiumHeadlessShell = false;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -196,33 +193,13 @@ let
|
|||
};
|
||||
});
|
||||
|
||||
browsers-mac = stdenv.mkDerivation {
|
||||
pname = "playwright-browsers";
|
||||
inherit (playwright) version;
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ cacert ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
export PLAYWRIGHT_BROWSERS_PATH=$out
|
||||
${playwright-core}/cli.js install
|
||||
rm -r $out/.links
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta.platforms = lib.platforms.darwin;
|
||||
};
|
||||
|
||||
browsers-linux = lib.makeOverridable (
|
||||
browsers = lib.makeOverridable (
|
||||
{
|
||||
withChromium ? true,
|
||||
withFirefox ? true,
|
||||
withWebkit ? true,
|
||||
withFfmpeg ? true,
|
||||
withChromiumHeadlessShell ? true,
|
||||
fontconfig_file ? makeFontsConf {
|
||||
fontDirectories = [ ];
|
||||
},
|
||||
|
@ -230,6 +207,7 @@ let
|
|||
let
|
||||
browsers =
|
||||
lib.optionals withChromium [ "chromium" ]
|
||||
++ lib.optionals withChromiumHeadlessShell [ "chromium-headless-shell" ]
|
||||
++ lib.optionals withFirefox [ "firefox" ]
|
||||
++ lib.optionals withWebkit [ "webkit" ]
|
||||
++ lib.optionals withFfmpeg [ "ffmpeg" ];
|
||||
|
@ -239,11 +217,12 @@ let
|
|||
map (
|
||||
name:
|
||||
let
|
||||
value = playwright-core.passthru.browsersJSON.${name};
|
||||
revName = if name == "chromium-headless-shell" then "chromium" else name;
|
||||
value = playwright-core.passthru.browsersJSON.${revName};
|
||||
in
|
||||
lib.nameValuePair
|
||||
# TODO check platform for revisionOverrides
|
||||
"${name}-${value.revision}"
|
||||
"${lib.replaceStrings [ "-" ] [ "_" ] name}-${value.revision}"
|
||||
(
|
||||
callPackage (./. + "/${name}.nix") (
|
||||
{
|
||||
|
|
|
@ -10,8 +10,10 @@ fetchzip {
|
|||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-FEm62UvMv0h6Sav93WmbPLw3CW1L1xg4nD26ca5ol38=";
|
||||
aarch64-linux = "sha256-jtQ+NS++VHRiKoIV++PIxEnyVnYtVwUyNlSILKSH4A4=";
|
||||
x86_64-linux = "sha256-AWTiui+ccKHxsIaQSgc5gWCJT5gYwIWzAEqSuKgVqZU=";
|
||||
aarch64-linux = "sha256-1mOKO2lcnlwLsC6ob//xKnKrCOp94pw8X14uBxCdj0Q=";
|
||||
x86_64-darwin = "sha256-zJ8BMzdneV6LlEt4I034l5u86dwW4UmO/UazWikpKV4=";
|
||||
aarch64-darwin = "sha256-ky10UQj+XPVGpaWAPvKd51C5brml0y9xQ6iKcrxAMRc=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
}
|
||||
|
|
|
@ -9,31 +9,48 @@
|
|||
throwSystem,
|
||||
}:
|
||||
let
|
||||
suffix' =
|
||||
if lib.hasPrefix "linux" suffix then "ubuntu-22.04" + (lib.removePrefix "linux" suffix) else suffix;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "playwright-firefox";
|
||||
src = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/firefox/${revision}/firefox-${suffix'}.zip";
|
||||
firefox-linux = stdenv.mkDerivation {
|
||||
name = "playwright-firefox";
|
||||
src = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/firefox/${revision}/firefox-${
|
||||
"ubuntu-22.04" + (lib.removePrefix "linux" suffix)
|
||||
}.zip";
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-53DXgD/OzGo7fEp/DBX1TiBBpFSHwiluqBji6rFKTtE=";
|
||||
aarch64-linux = "sha256-CBg2PgAXU1ZWUob73riEkQmn/EmIqhvOgBPSAphkAyM=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
|
||||
inherit (firefox-bin.unwrapped)
|
||||
nativeBuildInputs
|
||||
buildInputs
|
||||
runtimeDependencies
|
||||
appendRunpaths
|
||||
patchelfFlags
|
||||
;
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/firefox
|
||||
cp -R . $out/firefox
|
||||
'';
|
||||
};
|
||||
firefox-darwin = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/firefox/${revision}/firefox-${suffix}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-Hd9LlSRLW51gDoFyszqvg46Q/sMizLRsVKAN9atbwsw=";
|
||||
aarch64-linux = "sha256-SEXH3gLOfNjOcnNWQjQ5gaaow47veVs0BoTYSgXw+24=";
|
||||
x86_64-darwin = "sha256-GbrbNMFv1dT8Duo2otoZvmZk4Sgj81aRNwPAGKkRlnI=";
|
||||
aarch64-darwin = "sha256-/e51eJTCqr8zEeWWJNS2UgPT9Y+a33Dj619JkCVVeRs=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
|
||||
inherit (firefox-bin.unwrapped)
|
||||
nativeBuildInputs
|
||||
buildInputs
|
||||
runtimeDependencies
|
||||
appendRunpaths
|
||||
patchelfFlags
|
||||
;
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/firefox
|
||||
cp -R . $out/firefox
|
||||
'';
|
||||
in
|
||||
{
|
||||
x86_64-linux = firefox-linux;
|
||||
aarch64-linux = firefox-linux;
|
||||
x86_64-darwin = firefox-darwin;
|
||||
aarch64-darwin = firefox-darwin;
|
||||
}
|
||||
.${system} or throwSystem
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
makeWrapper,
|
||||
autoPatchelfHook,
|
||||
patchelfUnstable,
|
||||
|
||||
fetchpatch,
|
||||
libjxl,
|
||||
brotli,
|
||||
at-spi2-atk,
|
||||
cairo,
|
||||
flite,
|
||||
|
@ -19,6 +21,7 @@
|
|||
harfbuzzFull,
|
||||
icu70,
|
||||
lcms,
|
||||
libavif,
|
||||
libdrm,
|
||||
libepoxy,
|
||||
libevent,
|
||||
|
@ -50,7 +53,12 @@
|
|||
}:
|
||||
let
|
||||
suffix' =
|
||||
if lib.hasPrefix "linux" suffix then "ubuntu-22.04" + (lib.removePrefix "linux" suffix) else suffix;
|
||||
if lib.hasPrefix "linux" suffix then
|
||||
"ubuntu-22.04" + (lib.removePrefix "linux" suffix)
|
||||
else if lib.hasPrefix "mac" suffix then
|
||||
"mac-14" + (lib.removePrefix "mac" suffix)
|
||||
else
|
||||
suffix;
|
||||
libvpx' = libvpx.overrideAttrs (
|
||||
finalAttrs: previousAttrs: {
|
||||
version = "1.12.0";
|
||||
|
@ -62,74 +70,146 @@ let
|
|||
};
|
||||
}
|
||||
);
|
||||
libavif' = libavif.overrideAttrs (
|
||||
finalAttrs: previousAttrs: {
|
||||
version = "0.9.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "AOMediaCodec";
|
||||
repo = finalAttrs.pname;
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-ME/mkaHhFeHajTbc7zhg9vtf/8XgkgSRu9I/mlQXnds=";
|
||||
};
|
||||
postPatch = "";
|
||||
}
|
||||
);
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "playwright-webkit";
|
||||
src = fetchzip {
|
||||
libjxl' = libjxl.overrideAttrs (
|
||||
finalAttrs: previousAttrs: {
|
||||
version = "0.8.2";
|
||||
src = fetchFromGitHub {
|
||||
owner = "libjxl";
|
||||
repo = "libjxl";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-I3PGgh0XqRkCFz7lUZ3Q4eU0+0GwaQcVb6t4Pru1kKo=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
patches = [
|
||||
# Add missing <atomic> content to fix gcc compilation for RISCV architecture
|
||||
# https://github.com/libjxl/libjxl/pull/2211
|
||||
(fetchpatch {
|
||||
url = "https://github.com/libjxl/libjxl/commit/22d12d74e7bc56b09cfb1973aa89ec8d714fa3fc.patch";
|
||||
hash = "sha256-X4fbYTMS+kHfZRbeGzSdBW5jQKw8UN44FEyFRUtw0qo=";
|
||||
})
|
||||
];
|
||||
postPatch = "";
|
||||
postInstall = "";
|
||||
|
||||
cmakeFlags =
|
||||
[
|
||||
"-DJPEGXL_FORCE_SYSTEM_BROTLI=ON"
|
||||
"-DJPEGXL_FORCE_SYSTEM_HWY=ON"
|
||||
"-DJPEGXL_FORCE_SYSTEM_GTEST=ON"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isStatic [
|
||||
"-DJPEGXL_STATIC=ON"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch32 [
|
||||
"-DJPEGXL_FORCE_NEON=ON"
|
||||
];
|
||||
}
|
||||
);
|
||||
webkit-linux = stdenv.mkDerivation {
|
||||
name = "playwright-webkit";
|
||||
src = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-jw/wQ2Ql7KNpquz5CK+Mo6nPcCbMf8jeSQT64Vt/sLs=";
|
||||
aarch64-linux = "sha256-vKAvl1kMxTE4CsDryseWF5lxf2iYOYkHHXAdPCnfnHk=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
patchelfUnstable
|
||||
makeWrapper
|
||||
];
|
||||
buildInputs = [
|
||||
at-spi2-atk
|
||||
cairo
|
||||
flite
|
||||
fontconfig.lib
|
||||
freetype
|
||||
glib
|
||||
brotli
|
||||
libjxl'
|
||||
gst_all_1.gst-plugins-bad
|
||||
gst_all_1.gst-plugins-base
|
||||
gst_all_1.gstreamer
|
||||
harfbuzz
|
||||
harfbuzzFull
|
||||
icu70
|
||||
lcms
|
||||
libavif'
|
||||
libdrm
|
||||
libepoxy
|
||||
libevent
|
||||
libgcc.lib
|
||||
libgcrypt
|
||||
libgpg-error
|
||||
libjpeg8
|
||||
libopus
|
||||
libpng
|
||||
libsoup_3
|
||||
libtasn1
|
||||
libwebp
|
||||
libwpe
|
||||
libwpe-fdo
|
||||
libvpx'
|
||||
libxml2
|
||||
libxslt
|
||||
mesa
|
||||
sqlite
|
||||
systemdLibs
|
||||
wayland-scanner
|
||||
woff2.lib
|
||||
libxkbcommon
|
||||
zlib
|
||||
];
|
||||
|
||||
patchelfFlags = [ "--no-clobber-old-sections" ];
|
||||
buildPhase = ''
|
||||
cp -R . $out
|
||||
|
||||
# remove unused gtk browser
|
||||
rm -rf $out/minibrowser-gtk
|
||||
# remove bundled libs
|
||||
rm -rf $out/minibrowser-wpe/sys
|
||||
|
||||
# TODO: still fails on ubuntu trying to find libEGL_mesa.so.0
|
||||
wrapProgram $out/minibrowser-wpe/bin/MiniBrowser \
|
||||
--prefix GIO_EXTRA_MODULES ":" "${glib-networking}/lib/gio/modules/" \
|
||||
--prefix LD_LIBRARY_PATH ":" $out/minibrowser-wpe/lib
|
||||
|
||||
'';
|
||||
};
|
||||
webkit-darwin = fetchzip {
|
||||
url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip";
|
||||
stripRoot = false;
|
||||
hash =
|
||||
{
|
||||
x86_64-linux = "sha256-pHYGQYwu47jdOAD+/mLrP6Dd+2aDMHENddVwAu0uEfI=";
|
||||
aarch64-linux = "sha256-0UeYWjeFnQ8yVa3juWg7Z7VF1GDbP4pJ9OUJRbv1OJw=";
|
||||
x86_64-darwin = "sha256-6GpzcA77TthcZEtAC7s3dVpnLk31atw7EPxKUZeC5i4=";
|
||||
aarch64-darwin = "sha256-lDyeehVveciOsm4JZvz7CPphkl/ryRK1rz7DOcEDzYc=";
|
||||
}
|
||||
.${system} or throwSystem;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
patchelfUnstable
|
||||
makeWrapper
|
||||
];
|
||||
buildInputs = [
|
||||
at-spi2-atk
|
||||
cairo
|
||||
flite
|
||||
fontconfig.lib
|
||||
freetype
|
||||
glib
|
||||
gst_all_1.gst-plugins-bad
|
||||
gst_all_1.gst-plugins-base
|
||||
gst_all_1.gstreamer
|
||||
harfbuzz
|
||||
harfbuzzFull
|
||||
icu70
|
||||
lcms
|
||||
libdrm
|
||||
libepoxy
|
||||
libevent
|
||||
libgcc.lib
|
||||
libgcrypt
|
||||
libgpg-error
|
||||
libjpeg8
|
||||
libopus
|
||||
libpng
|
||||
libsoup_3
|
||||
libtasn1
|
||||
libwebp
|
||||
libwpe
|
||||
libwpe-fdo
|
||||
libvpx'
|
||||
libxml2
|
||||
libxslt
|
||||
mesa
|
||||
sqlite
|
||||
systemdLibs
|
||||
wayland-scanner
|
||||
woff2.lib
|
||||
libxkbcommon
|
||||
zlib
|
||||
];
|
||||
|
||||
patchelfFlags = [ "--no-clobber-old-sections" ];
|
||||
buildPhase = ''
|
||||
cp -R . $out
|
||||
|
||||
# remove unused gtk browser
|
||||
rm -rf $out/minibrowser-gtk
|
||||
|
||||
wrapProgram $out/minibrowser-wpe/bin/MiniBrowser \
|
||||
--prefix GIO_EXTRA_MODULES ":" "${glib-networking}/lib/gio/modules/"
|
||||
'';
|
||||
in
|
||||
{
|
||||
x86_64-linux = webkit-linux;
|
||||
aarch64-linux = webkit-linux;
|
||||
x86_64-darwin = webkit-darwin;
|
||||
aarch64-darwin = webkit-darwin;
|
||||
}
|
||||
.${system} or throwSystem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue