nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 glib,
6 libxcb,
7 nspr,
8 nss,
9 autoPatchelfHook,
10 unzip,
11}:
12
13version: hashes:
14let
15 pname = "electron-chromedriver";
16
17 meta = {
18 homepage = "https://www.electronjs.org/";
19 description = "WebDriver server for running Selenium tests on Chrome";
20 longDescription = ''
21 WebDriver is an open source tool for automated testing of webapps across
22 many browsers. It provides capabilities for navigating to web pages, user
23 input, JavaScript execution, and more. ChromeDriver is a standalone
24 server that implements the W3C WebDriver standard. This is
25 an unofficial build of ChromeDriver compiled by the Electronjs
26 project.
27 '';
28 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
29 license = lib.licenses.mit;
30 maintainers = with lib.maintainers; [
31 liammurphy14
32 ];
33 teams = [ lib.teams.electron ];
34 platforms = [
35 "x86_64-darwin"
36 "x86_64-linux"
37 "armv7l-linux"
38 "aarch64-linux"
39 "aarch64-darwin"
40 ];
41 mainProgram = "chromedriver";
42 };
43
44 fetcher =
45 vers: tag: hash:
46 fetchurl {
47 url = "https://github.com/electron/electron/releases/download/v${vers}/chromedriver-v${vers}-${tag}.zip";
48 sha256 = hash;
49 };
50
51 tags = {
52 x86_64-linux = "linux-x64";
53 aarch64-linux = "linux-arm64";
54 armv7l-linux = "linux-armv7l";
55 x86_64-darwin = "darwin-x64";
56 aarch64-darwin = "darwin-arm64";
57 };
58
59 get = as: platform: as.${platform.system} or (throw "Unsupported system: ${platform.system}");
60
61 common = platform: {
62 inherit pname version meta;
63 src = fetcher version (get tags platform) (get hashes platform);
64
65 buildInputs = [
66 (lib.getLib stdenv.cc.cc)
67 glib
68 libxcb
69 nspr
70 nss
71 ];
72 };
73
74 linux = {
75 nativeBuildInputs = [
76 autoPatchelfHook
77 unzip
78 ];
79
80 dontUnpack = true;
81 dontBuild = true;
82
83 installPhase = ''
84 runHook preInstall
85 unzip $src
86 install -m777 -D chromedriver $out/bin/chromedriver
87 runHook postInstall
88 '';
89 };
90
91 darwin = {
92 nativeBuildInputs = [ unzip ];
93
94 dontUnpack = true;
95 dontBuild = true;
96
97 # darwin distributions come with libffmpeg dependency + icudtl.dat file
98 installPhase = ''
99 runHook preInstall
100 unzip $src
101 install -m777 -D chromedriver $out/bin/chromedriver
102 cp libffmpeg.dylib $out/bin/libffmpeg.dylib
103 cp icudtl.dat $out/bin/icudtl.dat
104 runHook postInstall
105 '';
106 };
107in
108stdenv.mkDerivation (
109 (common stdenv.hostPlatform) // (if stdenv.hostPlatform.isDarwin then darwin else linux)
110)