From 4c476e1c70636614637a4c8fc0a1a90c4dee46f4 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Tue, 9 Aug 2022 17:53:35 -0400 Subject: [PATCH 1/5] electron: use wrapper instead of symlink for bin on darwin electron fails to run through a symlink: ``` GPU process isn't usable. Goodbye. ``` --- pkgs/development/tools/electron/generic.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/electron/generic.nix b/pkgs/development/tools/electron/generic.nix index 6091fa902c77..97e7fb520346 100644 --- a/pkgs/development/tools/electron/generic.nix +++ b/pkgs/development/tools/electron/generic.nix @@ -104,14 +104,17 @@ let }; darwin = { - nativeBuildInputs = [ unzip ]; + nativeBuildInputs = [ + makeWrapper + unzip + ]; buildCommand = '' mkdir -p $out/Applications unzip $src mv Electron.app $out/Applications mkdir -p $out/bin - ln -s $out/Applications/Electron.app/Contents/MacOS/Electron $out/bin/electron + makeWrapper $out/Applications/Electron.app/Contents/MacOS/Electron $out/bin/electron ''; }; in From 45a58291de50d9587fcfaa2e75a3f162282bad9f Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Tue, 26 Jul 2022 22:34:45 -0400 Subject: [PATCH 2/5] deltachat-desktop: remove special case for electron on darwin --- .../instant-messengers/deltachat-desktop/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/deltachat-desktop/default.nix b/pkgs/applications/networking/instant-messengers/deltachat-desktop/default.nix index df97777409cd..835442642348 100644 --- a/pkgs/applications/networking/instant-messengers/deltachat-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/deltachat-desktop/default.nix @@ -32,10 +32,6 @@ let hash = "sha256-4rpoDQ3o0WdWg/TmazTI+J0hL/MxwHcNMXWMq7GE7Tk="; }; }); - electronExec = if stdenv.isDarwin then - "${electron_18}/Applications/Electron.app/Contents/MacOS/Electron" - else - "${electron_18}/bin/electron"; esbuild' = esbuild.override { buildGoModule = args: buildGoModule (args // rec { version = "0.12.29"; @@ -102,7 +98,7 @@ in nodePackages.deltachat-desktop.override rec { $out/lib/node_modules/deltachat-desktop/html-dist/fonts done - makeWrapper ${electronExec} $out/bin/deltachat \ + makeWrapper ${electron_18}/bin/electron $out/bin/deltachat \ --set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher${stdenv.hostPlatform.extensions.sharedLibrary} \ --add-flags $out/lib/node_modules/deltachat-desktop ''; From 2c035ca89fa444e8ef492976678de84ac189241d Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Tue, 26 Jul 2022 22:35:39 -0400 Subject: [PATCH 3/5] element-desktop: remove special case for electron on darwin --- .../networking/instant-messengers/element/element-desktop.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix index c8c186045394..5b7c23f7c7ac 100644 --- a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix +++ b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix @@ -19,7 +19,6 @@ let pinData = lib.importJSON ./pin.json; executableName = "element-desktop"; - electron_exec = if stdenv.isDarwin then "${electron}/Applications/Electron.app/Contents/MacOS/Electron" else "${electron}/bin/electron"; keytar = callPackage ./keytar { inherit Security AppKit; }; seshat = callPackage ./seshat { inherit CoreServices; }; in @@ -83,7 +82,7 @@ mkYarnPackage rec { # executable wrapper # LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102 - makeWrapper '${electron_exec}' "$out/bin/${executableName}" \ + makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \ --set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \ --add-flags "$out/share/element/electron" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}" From 6877e896fc728e0a09c26954a5ea56e4bfc2a0f6 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Tue, 26 Jul 2022 22:35:53 -0400 Subject: [PATCH 4/5] schildichat-desktop: remove special case for electron on darwin --- .../instant-messengers/schildichat/schildichat-desktop.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix b/pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix index e2b4cafe9936..d1a1c8d64690 100644 --- a/pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix +++ b/pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix @@ -19,7 +19,6 @@ let pinData = lib.importJSON ./pin.json; executableName = "schildichat-desktop"; - electron_exec = if stdenv.isDarwin then "${electron}/Applications/Electron.app/Contents/MacOS/Electron" else "${electron}/bin/electron"; in stdenv.mkDerivation rec { pname = "schildichat-desktop"; @@ -88,7 +87,7 @@ stdenv.mkDerivation rec { done # executable wrapper - makeWrapper '${electron_exec}' "$out/bin/${executableName}" \ + makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \ --add-flags "$out/share/element/electron" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}" From 263b0365db9d78025bbd387c485ab42bfeb2e800 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Tue, 26 Jul 2022 22:37:34 -0400 Subject: [PATCH 5/5] micropad: remove special case for electron on darwin --- pkgs/applications/office/micropad/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/applications/office/micropad/default.nix b/pkgs/applications/office/micropad/default.nix index c6f0ae106e2c..c92cfdb97a18 100644 --- a/pkgs/applications/office/micropad/default.nix +++ b/pkgs/applications/office/micropad/default.nix @@ -11,10 +11,6 @@ }: let executableName = "micropad"; - electron_exec = - if stdenv.isDarwin - then "${electron}/Applications/Electron.app/Contents/MacOS/Electron" - else "${electron}/bin/electron"; in mkYarnPackage rec { pname = "micropad"; @@ -64,7 +60,7 @@ in done # executable wrapper - makeWrapper '${electron_exec}' "$out/bin/${executableName}" \ + makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \ --add-flags "$out/share/micropad" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"