cypress: add support for aarch64 on darwin

This commit is contained in:
kolaente 2024-09-18 14:46:22 +02:00
parent 71df0d5dd0
commit 7f4dd46fab
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -12,6 +12,7 @@
, unzip , unzip
, wrapGAppsHook3 , wrapGAppsHook3
, xorg , xorg
, darwin
}: }:
let let
@ -24,6 +25,10 @@ let
platform = "linux-arm64"; platform = "linux-arm64";
checksum = "sha256-rB0ak6jYnJMb0aHDLAyhaGoOFK4FXDLEOeofNdW/Wk8="; checksum = "sha256-rB0ak6jYnJMb0aHDLAyhaGoOFK4FXDLEOeofNdW/Wk8=";
}; };
aarch64-darwin = {
platform = "darwin-arm64";
checksum = "sha256-L2rhtB/DIK7Qum2YNoWVBn4mf+DA3rbcBUfZEEa/C8c=";
};
}; };
inherit (stdenv.hostPlatform) system; inherit (stdenv.hostPlatform) system;
binary = availableBinaries.${system} or (throw "cypress: No binaries available for system ${system}"); binary = availableBinaries.${system} or (throw "cypress: No binaries available for system ${system}");
@ -35,27 +40,37 @@ in stdenv.mkDerivation rec {
src = fetchzip { src = fetchzip {
url = "https://cdn.cypress.io/desktop/${version}/${platform}/cypress.zip"; url = "https://cdn.cypress.io/desktop/${version}/${platform}/cypress.zip";
sha256 = checksum; sha256 = checksum;
stripRoot = !stdenv.isDarwin;
}; };
# don't remove runtime deps # don't remove runtime deps
dontPatchELF = true; dontPatchELF = true;
nativeBuildInputs = [ autoPatchelfHook (wrapGAppsHook3.override { makeWrapper = makeShellWrapper; }) unzip makeShellWrapper]; nativeBuildInputs = [ unzip makeShellWrapper ]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook (wrapGAppsHook3.override { makeWrapper = makeShellWrapper; }) ];
buildInputs = with xorg; [ buildInputs = lib.optionals stdenv.isLinux (with xorg; [
libXScrnSaver libXScrnSaver
libXdamage libXdamage
libXtst libXtst
libxshmfence libxshmfence
] ++ [
nss nss
gtk2 gtk2
alsa-lib alsa-lib
gtk3 gtk3
mesa # for libgbm mesa # for libgbm
]; ]) ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
Cocoa
CoreServices
CoreMedia
CoreAudio
AudioToolbox
AVFoundation
Foundation
ApplicationServices
]);
runtimeDependencies = [ (lib.getLib udev) ]; runtimeDependencies = lib.optional stdenv.isLinux (lib.getLib udev);
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -68,11 +83,15 @@ in stdenv.mkDerivation rec {
printf '{"version":"%b"}' $version > $out/bin/resources/app/package.json printf '{"version":"%b"}' $version > $out/bin/resources/app/package.json
# Cypress now looks for binary_state.json in bin # Cypress now looks for binary_state.json in bin
echo '{"verified": true}' > $out/binary_state.json echo '{"verified": true}' > $out/binary_state.json
ln -s $out/opt/cypress/Cypress $out/bin/cypress ${if stdenv.isDarwin then ''
ln -s $out/opt/cypress/Cypress.app/Contents/MacOS/Cypress $out/bin/cypress
'' else ''
ln -s $out/opt/cypress/Cypress $out/bin/cypress
''}
runHook postInstall runHook postInstall
''; '';
postFixup = '' postFixup = lib.optionalString (!stdenv.isDarwin) ''
# exit with 1 after 25.05 # exit with 1 after 25.05
makeWrapper $out/opt/cypress/Cypress $out/bin/Cypress \ makeWrapper $out/opt/cypress/Cypress $out/bin/Cypress \
--run 'echo "Warning: Use the lowercase cypress executable instead of the capitalized one."' --run 'echo "Warning: Use the lowercase cypress executable instead of the capitalized one."'