From 174479d0404df19ecc6cb8e9a06c9f4e41a30a27 Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:24:11 +0200 Subject: [PATCH] playwright-driver.browsers: expose raw fontconfig file --- pkgs/development/web/playwright/chromium.nix | 9 ++------- pkgs/development/web/playwright/driver.nix | 21 ++++++++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pkgs/development/web/playwright/chromium.nix b/pkgs/development/web/playwright/chromium.nix index 0da9e66641c1..709cef5c5ca4 100644 --- a/pkgs/development/web/playwright/chromium.nix +++ b/pkgs/development/web/playwright/chromium.nix @@ -1,15 +1,10 @@ { runCommand, makeWrapper, - makeFontsConf, + fontconfig_file, chromium, ... }: -let - fontconfig = makeFontsConf { - fontDirectories = [ ]; - }; -in runCommand "playwright-chromium" { nativeBuildInputs = [ @@ -25,5 +20,5 @@ runCommand "playwright-chromium" # 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} + --set-default FONTCONFIG_FILE ${fontconfig_file} '' diff --git a/pkgs/development/web/playwright/driver.nix b/pkgs/development/web/playwright/driver.nix index f05d5fd6c081..12db713de82d 100644 --- a/pkgs/development/web/playwright/driver.nix +++ b/pkgs/development/web/playwright/driver.nix @@ -217,12 +217,15 @@ let meta.platforms = lib.platforms.darwin; }; - browsers-linux = + browsers-linux = lib.makeOverridable ( { withChromium ? true, withFirefox ? true, withWebkit ? true, withFfmpeg ? true, + fontconfig_file ? makeFontsConf { + fontDirectories = [ ]; + }, }: let browsers = @@ -242,14 +245,20 @@ let # TODO check platform for revisionOverrides "${name}-${value.revision}" ( - callPackage ./${name}.nix { - inherit suffix system throwSystem; - inherit (value) revision; - } + callPackage ./${name}.nix ( + { + inherit suffix system throwSystem; + inherit (value) revision; + } + // lib.optionalAttrs (name == "chromium") { + inherit fontconfig_file; + } + ) ) ) browsers ) - ); + ) + ); in { playwright-core = playwright-core;