1{
2 autoPatchelfHook,
3 fetchzip,
4 glib,
5 lib,
6 libxcb,
7 nspr,
8 nss,
9 stdenvNoCC,
10}:
11
12stdenvNoCC.mkDerivation (finalAttrs: {
13 pname = "msedgedriver";
14 # finding a version that has all 4 builds is a pain
15 # https://msedgewebdriverstorage.z22.web.core.windows.net/?form=MA13LH
16 version = "130.0.2849.1";
17
18 src =
19 let
20 inherit (stdenvNoCC.hostPlatform) system;
21 selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
22 suffix = selectSystem {
23 x86_64-linux = "linux64";
24 aarch64-linux = "arm64";
25 x86_64-darwin = "mac64";
26 aarch64-darwin = "mac64_m1";
27 };
28
29 hash = selectSystem {
30 x86_64-linux = "sha256-U6YGD2PAhVUa7f+R5pmKLazGLOBbf3bRqzlwIJewA+w=";
31 aarch64-linux = "sha256-QJ1jRw8kkWbT8US5qI8DMZI/7Q8yJWpFXrfzGdxDWKE=";
32 x86_64-darwin = "sha256-Ejcv1DtuEiLJvTsv48AwoCQlFO3xM9PkM3HvZG65AC4=";
33 aarch64-darwin = "sha256-ykn4bYREE6xmJY02WiCRGsGnyWjnmnZM8FemK4XZqhc=";
34 };
35 in
36 fetchzip {
37 url = "https://msedgedriver.azureedge.net/${finalAttrs.version}/edgedriver_${suffix}.zip";
38 inherit hash;
39 stripRoot = false;
40 };
41
42 buildInputs = [
43 glib
44 libxcb
45 nspr
46 nss
47 ];
48
49 nativeBuildInputs = lib.optionals (!stdenvNoCC.hostPlatform.isDarwin) [ autoPatchelfHook ];
50
51 installPhase =
52 if stdenvNoCC.hostPlatform.isDarwin then
53 ''
54 runHook preInstall
55
56 mkdir -p $out/{Applications/msedgedriver,bin}
57 cp -R . $out/Applications/msedgedriver
58
59 runHook postInstall
60 ''
61 else
62 ''
63 runHook preInstall
64
65 install -m777 -D "msedgedriver" $out/bin/msedgedriver
66
67 runHook postInstall
68 '';
69
70 meta = {
71 homepage = "https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver";
72 description = "WebDriver implementation that controls an Edge browser running on the local machine";
73 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
74 license = lib.licenses.unfree;
75 maintainers = with lib.maintainers; [ cholli ];
76 platforms = [
77 "x86_64-linux"
78 "aarch64-linux"
79 "x86_64-darwin"
80 "aarch64-darwin"
81 ];
82 mainProgram = "msedgedriver";
83 };
84})