1{
2 runCommand,
3 makeWrapper,
4 fontconfig_file,
5 chromium,
6 fetchzip,
7 revision,
8 suffix,
9 system,
10 throwSystem,
11 lib,
12 alsa-lib,
13 at-spi2-atk,
14 atk,
15 autoPatchelfHook,
16 cairo,
17 cups,
18 dbus,
19 expat,
20 glib,
21 gobject-introspection,
22 libGL,
23 libgbm,
24 libgcc,
25 libxkbcommon,
26 nspr,
27 nss,
28 pango,
29 patchelf,
30 pciutils,
31 stdenv,
32 systemd,
33 vulkan-loader,
34 xorg,
35 ...
36}:
37let
38 chromium-linux = stdenv.mkDerivation {
39 name = "playwright-chromium";
40 src = fetchzip {
41 url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-${suffix}.zip";
42 hash =
43 {
44 x86_64-linux = "sha256-R7nMCVpUqgRwtB0syhfIK81maiTVWr8lYBLp4bR8VBg=";
45 aarch64-linux = "sha256-4fc4X7QwBigktmEeseuqIyEeV70Dy3eO/femXrftMd0=";
46 }
47 .${system} or throwSystem;
48 };
49
50 nativeBuildInputs = [
51 autoPatchelfHook
52 patchelf
53 makeWrapper
54 ];
55 buildInputs = [
56 alsa-lib
57 at-spi2-atk
58 atk
59 cairo
60 cups
61 dbus
62 expat
63 glib
64 gobject-introspection
65 libgbm
66 libgcc
67 libxkbcommon
68 nspr
69 nss
70 pango
71 stdenv.cc.cc.lib
72 systemd
73 xorg.libX11
74 xorg.libXcomposite
75 xorg.libXdamage
76 xorg.libXext
77 xorg.libXfixes
78 xorg.libXrandr
79 xorg.libxcb
80 ];
81
82 installPhase = ''
83 runHook preInstall
84
85 mkdir -p $out/chrome-linux
86 cp -R . $out/chrome-linux
87
88 wrapProgram $out/chrome-linux/chrome \
89 --set-default SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt \
90 --set-default FONTCONFIG_FILE ${fontconfig_file}
91
92 runHook postInstall
93 '';
94
95 appendRunpaths = lib.makeLibraryPath [
96 libGL
97 vulkan-loader
98 pciutils
99 ];
100
101 postFixup = ''
102 # replace bundled vulkan-loader since we are also already adding our own to RPATH
103 rm "$out/chrome-linux/libvulkan.so.1"
104 ln -s -t "$out/chrome-linux" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
105 '';
106 };
107 chromium-darwin = fetchzip {
108 url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-${suffix}.zip";
109 stripRoot = false;
110 hash =
111 {
112 x86_64-darwin = "sha256-0u1AStbUTX+qgUmg2DvL59B4b265WywDaBV+MdSuaNE=";
113 aarch64-darwin = "sha256-4pg4wmNTF8mw+APmdpvYlFxb9zc6OUh11oW5gCRKETY=";
114 }
115 .${system} or throwSystem;
116 };
117in
118{
119 x86_64-linux = chromium-linux;
120 aarch64-linux = chromium-linux;
121 x86_64-darwin = chromium-darwin;
122 aarch64-darwin = chromium-darwin;
123}
124.${system} or throwSystem