Loading pkgs/development/python-modules/playwright/default.nix +16 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,9 @@ setuptools-scm, playwright-driver, nixosTests, writeText, runCommand, pythonPackages, nodejs, }: Loading Loading @@ -81,6 +84,16 @@ buildPythonPackage rec { pyee ]; setupHook = writeText "setupHook.sh" '' addBrowsersPath () { if [[ ! -v PLAYWRIGHT_BROWSERS_PATH ]] ; then export PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}" fi } addEnvHooks "$targetOffset" addBrowsersPath ''; postInstall = '' ln -s ${driver} $out/${python.sitePackages}/playwright/driver ''; Loading @@ -96,6 +109,9 @@ buildPythonPackage rec { { driver = playwright-driver; browsers = playwright-driver.browsers; env = runCommand "playwright-env-test" { buildInputs = [ pythonPackages.playwright ]; } "python ${./test.py}"; } // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) playwright-python; Loading pkgs/development/python-modules/playwright/test.py 0 → 100644 +10 −0 Original line number Diff line number Diff line import os import sys from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch() context = browser.new_context() with open(os.environ["out"], "w") as f: f.write("OK") pkgs/development/web/playwright/driver.nix +19 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ makeFontsConf, makeWrapper, runCommand, writeText, cacert, }: let Loading Loading @@ -188,9 +189,27 @@ let runHook postInstall ''; setupHook = writeText "setupHook.sh" '' addBrowsersPath () { if [[ ! -v PLAYWRIGHT_BROWSERS_PATH ]] ; then export PLAYWRIGHT_BROWSERS_PATH="${playwright-core.passthru.browsers}" fi } addEnvHooks "$targetOffset" addBrowsersPath ''; meta = playwright.meta // { mainProgram = "playwright"; }; passthru.tests.env = runCommand "playwright-core-env-test" { buildInputs = [ nodejs playwright-core playwright-test ]; } "node ${./test.js}"; }); browsers = lib.makeOverridable ( Loading pkgs/development/web/playwright/test.js 0 → 100644 +8 −0 Original line number Diff line number Diff line const playwright = require('playwright'); const fs = require('fs'); playwright.chromium.launch() .then((browser) => { console.log('OK'); fs.writeFileSync(process.env.out, ''); process.exit(0); }); Loading
pkgs/development/python-modules/playwright/default.nix +16 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,9 @@ setuptools-scm, playwright-driver, nixosTests, writeText, runCommand, pythonPackages, nodejs, }: Loading Loading @@ -81,6 +84,16 @@ buildPythonPackage rec { pyee ]; setupHook = writeText "setupHook.sh" '' addBrowsersPath () { if [[ ! -v PLAYWRIGHT_BROWSERS_PATH ]] ; then export PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}" fi } addEnvHooks "$targetOffset" addBrowsersPath ''; postInstall = '' ln -s ${driver} $out/${python.sitePackages}/playwright/driver ''; Loading @@ -96,6 +109,9 @@ buildPythonPackage rec { { driver = playwright-driver; browsers = playwright-driver.browsers; env = runCommand "playwright-env-test" { buildInputs = [ pythonPackages.playwright ]; } "python ${./test.py}"; } // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) playwright-python; Loading
pkgs/development/python-modules/playwright/test.py 0 → 100644 +10 −0 Original line number Diff line number Diff line import os import sys from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch() context = browser.new_context() with open(os.environ["out"], "w") as f: f.write("OK")
pkgs/development/web/playwright/driver.nix +19 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ makeFontsConf, makeWrapper, runCommand, writeText, cacert, }: let Loading Loading @@ -188,9 +189,27 @@ let runHook postInstall ''; setupHook = writeText "setupHook.sh" '' addBrowsersPath () { if [[ ! -v PLAYWRIGHT_BROWSERS_PATH ]] ; then export PLAYWRIGHT_BROWSERS_PATH="${playwright-core.passthru.browsers}" fi } addEnvHooks "$targetOffset" addBrowsersPath ''; meta = playwright.meta // { mainProgram = "playwright"; }; passthru.tests.env = runCommand "playwright-core-env-test" { buildInputs = [ nodejs playwright-core playwright-test ]; } "node ${./test.js}"; }); browsers = lib.makeOverridable ( Loading
pkgs/development/web/playwright/test.js 0 → 100644 +8 −0 Original line number Diff line number Diff line const playwright = require('playwright'); const fs = require('fs'); playwright.chromium.launch() .then((browser) => { console.log('OK'); fs.writeFileSync(process.env.out, ''); process.exit(0); });