about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-10-28 04:38:07 +0200
committerGitHub <noreply@github.com>2023-10-28 04:38:07 +0200
commita41478261e52d9ed3caead2d68ba64870f0dcc2e (patch)
treec0d497722d841f0358b758e3df9637558f1ca791 /pkgs/applications/graphics
parent59c1bc2c1fe10a8940207788334aa9f0c6f30f03 (diff)
parente59b866c4eedd04f105aef2b908eb26c7ce01a99 (diff)
Merge pull request #262081 from wegank/drawio-darwin
drawio: unbreak on darwin
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/drawio/default.nix23
1 files changed, 18 insertions, 5 deletions
diff --git a/pkgs/applications/graphics/drawio/default.nix b/pkgs/applications/graphics/drawio/default.nix
index 92414531522e8..d0fb1280c3428 100644
--- a/pkgs/applications/graphics/drawio/default.nix
+++ b/pkgs/applications/graphics/drawio/default.nix
@@ -4,7 +4,6 @@
 , fetchYarnDeps
 , makeDesktopItem
 , copyDesktopItems
-, desktopToDarwinBundle
 , fixup_yarn_lock
 , makeWrapper
 , nodejs
@@ -30,12 +29,13 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    copyDesktopItems
     fixup_yarn_lock
     makeWrapper
     nodejs
     yarn
-  ] ++ lib.optional stdenv.isDarwin desktopToDarwinBundle;
+  ] ++ lib.optionals (!stdenv.isDarwin) [
+    copyDesktopItems
+  ];
 
   ELECTRON_SKIP_BINARY_DOWNLOAD = true;
 
@@ -54,9 +54,15 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     runHook preBuild
 
+  '' + lib.optionalString stdenv.isDarwin ''
+    cp -R ${electron}/Applications/Electron.app Electron.app
+    chmod -R u+w Electron.app
+    export CSC_IDENTITY_AUTO_DISCOVERY=false
+    sed -i "/afterSign/d" electron-builder-linux-mac.json
+  '' + ''
     yarn --offline run electron-builder --dir \
       --config electron-builder-linux-mac.json \
-      -c.electronDist=${electron}/libexec/electron \
+      -c.electronDist=${if stdenv.isDarwin then "." else "${electron}/libexec/electron"} \
       -c.electronVersion=${electron.version}
 
     runHook postBuild
@@ -65,6 +71,13 @@ stdenv.mkDerivation rec {
   installPhase = ''
     runHook preInstall
 
+  '' + lib.optionalString stdenv.isDarwin ''
+    mkdir -p $out/{Applications,bin}
+    mv dist/mac*/draw.io.app $out/Applications
+
+    # Symlinking `draw.io` doesn't work; seems to look for files in the wrong place.
+    makeWrapper $out/Applications/draw.io.app/Contents/MacOS/draw.io $out/bin/drawio
+  '' + lib.optionalString (!stdenv.isDarwin) ''
     mkdir -p "$out/share/lib/drawio"
     cp -r dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/drawio"
 
@@ -74,6 +87,7 @@ stdenv.mkDerivation rec {
       --add-flags "$out/share/lib/drawio/resources/app.asar" \
       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
       --inherit-argv0
+  '' + ''
 
     runHook postInstall
   '';
@@ -98,6 +112,5 @@ stdenv.mkDerivation rec {
     changelog = "https://github.com/jgraph/drawio-desktop/releases/tag/v${version}";
     maintainers = with maintainers; [ qyliss darkonion0 ];
     platforms = platforms.darwin ++ platforms.linux;
-    broken = stdenv.isDarwin;
   };
 }