1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
{
runCommand,
makeWrapper,
fontconfig_file,
chromium,
fetchzip,
revision,
browserVersion,
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,
libxrandr,
libxfixes,
libxext,
libxdamage,
libxcomposite,
libx11,
libxcb,
...
}:
let
download =
(import ./browser-downloads.nix {
name = "chromium";
inherit revision browserVersion;
}).${system} or throwSystem;
# Playwright expects different directory names for different architectures:
# - linux-x64 expects: chrome-linux64
# - linux-arm64 expects: chrome-linux
chromeDir =
{
x86_64-linux = "chrome-linux64";
aarch64-linux = "chrome-linux";
}
.${system} or throwSystem;
chromium-linux = stdenv.mkDerivation {
name = "playwright-chromium";
src = fetchzip {
inherit (download) url stripRoot;
hash =
{
x86_64-linux = "sha256-/0OwT0Asm4A/rUkFruw1JYWbDInFJPuDX0CEdNjeMLo=";
aarch64-linux = "sha256-5vNF1/utXGctixYJj/0qvi6X0qklIG9XCcet94feQoA=";
}
.${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/${chromeDir}
cp -R . $out/${chromeDir}
wrapProgram $out/${chromeDir}/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/${chromeDir}/libvulkan.so.1"
ln -s -t "$out/${chromeDir}" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
'';
};
chromium-darwin = fetchzip {
inherit (download) url stripRoot;
hash = "sha256-aJbvZQ1hY0FfDC+ZktfW2yNW3nwc0kh/P30+n/cmLf0=";
};
in
{
x86_64-linux = chromium-linux;
aarch64-linux = chromium-linux;
aarch64-darwin = chromium-darwin;
}
.${system} or throwSystem
|