Merge pull request #280825 from mattpolzin/fix-bruno-darwin-builds

bruno: fix darwin builds
This commit is contained in:
Fabián Heredia Montiel 2024-01-15 18:17:50 -06:00 committed by GitHub
commit fad7e7e0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 3 deletions

View File

@ -11607,6 +11607,12 @@
githubId = 279868;
name = "Matti Kariluoma";
};
mattpolzin = {
email = "matt.polzin@gmail.com";
github = "mattpolzin";
githubId = 2075353;
name = "Matt Polzin";
};
matt-snider = {
email = "matt.snider@protonmail.com";
github = "matt-snider";

View File

@ -1,5 +1,6 @@
{ lib
, stdenv
, fetchFromGitHub
, buildNpmPackage
, nix-update-script
@ -34,9 +35,10 @@ buildNpmPackage rec {
nativeBuildInputs = [
(writeShellScriptBin "phantomjs" "echo 2.1.1")
pkg-config
] ++ lib.optionals (! stdenv.isDarwin) [
makeWrapper
copyDesktopItems
pkg-config
];
buildInputs = [
@ -74,11 +76,27 @@ buildNpmPackage rec {
pushd packages/bruno-electron
${if stdenv.isDarwin then ''
cp -r ${electron}/Applications/Electron.app ./
find ./Electron.app -name 'Info.plist' | xargs -d '\n' chmod +rw
substituteInPlace electron-builder-config.js \
--replace "identity: 'Anoop MD (W7LPPWA48L)'" 'identity: null' \
--replace "afterSign: 'notarize.js'," ""
npm exec electron-builder -- \
--dir \
--config electron-builder-config.js \
-c.electronDist=./ \
-c.electronVersion=${electron.version} \
-c.npmRebuild=false
'' else ''
npm exec electron-builder -- \
--dir \
-c.electronDist=${electron}/libexec/electron \
-c.electronVersion=${electron.version} \
-c.npmRebuild=false
''}
popd
'';
@ -88,9 +106,15 @@ buildNpmPackage rec {
installPhase = ''
runHook preInstall
${if stdenv.isDarwin then ''
mkdir -p $out/Applications
cp -R packages/bruno-electron/out/**/Bruno.app $out/Applications/
'' else ''
mkdir -p $out/opt/bruno $out/bin
cp -r packages/bruno-electron/dist/linux-unpacked/{locales,resources{,.pak}} $out/opt/bruno
cp -r packages/bruno-electron/dist/linux*-unpacked/{locales,resources{,.pak}} $out/opt/bruno
makeWrapper ${lib.getExe electron} $out/bin/bruno \
--add-flags $out/opt/bruno/resources/app.asar \
@ -102,6 +126,7 @@ buildNpmPackage rec {
size=${"$"}{s}x$s
install -Dm644 $src/packages/bruno-electron/resources/icons/png/$size.png $out/share/icons/hicolor/$size/apps/bruno.png
done
''}
runHook postInstall
'';
@ -113,7 +138,7 @@ buildNpmPackage rec {
homepage = "https://www.usebruno.com";
inherit (electron.meta) platforms;
license = licenses.mit;
maintainers = with maintainers; [ water-sucks lucasew kashw2 ];
maintainers = with maintainers; [ water-sucks lucasew kashw2 mattpolzin ];
mainProgram = "bruno";
};
}