Unverified Commit fad7e7e0 authored by Fabián Heredia Montiel's avatar Fabián Heredia Montiel Committed by GitHub
Browse files

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

bruno: fix darwin builds
parents 61575afc 529c8626
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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";
+28 −3
Original line number Diff line number Diff line
{ 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";
  };
}