1{ alsa-lib
2, autoPatchelfHook
3, callPackage
4, fetchzip
5, gtk2
6, gtk3
7, lib
8, mesa
9, nss
10, stdenv
11, udev
12, unzip
13, wrapGAppsHook3
14, xorg
15}:
16
17let
18 availableBinaries = {
19 x86_64-linux = {
20 platform = "linux-x64";
21 checksum = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM=";
22 };
23 aarch64-linux = {
24 platform = "linux-arm64";
25 checksum = "sha256-aW3cUZqAdiOLzOC9BQM/bTkDVyw24Dx9nBSXgbiKe4c=";
26 };
27 };
28 inherit (stdenv.hostPlatform) system;
29 binary = availableBinaries.${system} or (throw "cypress: No binaries available for system ${system}");
30 inherit (binary) platform checksum;
31in stdenv.mkDerivation rec {
32 pname = "cypress";
33 version = "13.2.0";
34
35 src = fetchzip {
36 url = "https://cdn.cypress.io/desktop/${version}/${platform}/cypress.zip";
37 sha256 = checksum;
38 };
39
40 # don't remove runtime deps
41 dontPatchELF = true;
42
43 nativeBuildInputs = [ autoPatchelfHook wrapGAppsHook3 unzip ];
44
45 buildInputs = with xorg; [
46 libXScrnSaver
47 libXdamage
48 libXtst
49 libxshmfence
50 ] ++ [
51 nss
52 gtk2
53 alsa-lib
54 gtk3
55 mesa # for libgbm
56 ];
57
58 runtimeDependencies = [ (lib.getLib udev) ];
59
60 installPhase = ''
61 runHook preInstall
62
63 mkdir -p $out/bin $out/opt/cypress
64 cp -vr * $out/opt/cypress/
65 # Let's create the file binary_state ourselves to make the npm package happy on initial verification.
66 # Cypress now verifies version by reading bin/resources/app/package.json
67 mkdir -p $out/bin/resources/app
68 printf '{"version":"%b"}' $version > $out/bin/resources/app/package.json
69 # Cypress now looks for binary_state.json in bin
70 echo '{"verified": true}' > $out/binary_state.json
71 ln -s $out/opt/cypress/Cypress $out/bin/Cypress
72
73 runHook postInstall
74 '';
75
76 passthru = {
77 updateScript = ./update.sh;
78
79 tests = {
80 # We used to have a test here, but was removed because
81 # - it broke, and ofborg didn't fail https://github.com/NixOS/ofborg/issues/629
82 # - it had a large footprint in the repo; prefer RFC 92 or an ugly FOD fetcher?
83 # - the author switched away from cypress.
84 # To provide a test once more, you may find useful information in
85 # https://github.com/NixOS/nixpkgs/pull/223903
86 };
87 };
88
89 meta = with lib; {
90 description = "Fast, easy and reliable testing for anything that runs in a browser";
91 homepage = "https://www.cypress.io";
92 mainProgram = "Cypress";
93 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
94 license = licenses.mit;
95 platforms = lib.attrNames availableBinaries;
96 maintainers = with maintainers; [ tweber mmahut Crafter ];
97 };
98}