From 8cfff8cba9ce0faf859a256f2b0dd503ad7fa1de Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:00:31 +0100 Subject: [PATCH] electron-bin: don't wrap inside libexec This change helps bring electron-bin to a similar structure as the source builds of electron. The primary motivation of this change was to ensure that the `electron` binary inside `libexec/electron` is an actual binary and not a wrapper. This way `electron-fuses` will not complain about not being able to find the necessary sentinel strings inside the binary. --- .../tools/electron/binary/generic.nix | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/pkgs/development/tools/electron/binary/generic.nix b/pkgs/development/tools/electron/binary/generic.nix index 792ad818a20c..df92207ec0b2 100644 --- a/pkgs/development/tools/electron/binary/generic.nix +++ b/pkgs/development/tools/electron/binary/generic.nix @@ -151,31 +151,26 @@ let dontBuild = true; installPhase = '' - mkdir -p $out/libexec/electron $out/bin + mkdir -p $out/libexec/electron unzip -d $out/libexec/electron $src - ln -s $out/libexec/electron/electron $out/bin chmod u-x $out/libexec/electron/*.so* ''; - # We use null here to not cause unnecessary rebuilds. - dontWrapGApps = if needsAarch64PageSizeFix then true else null; - preFixup = - if needsAarch64PageSizeFix then - '' - wrapProgram "$out/libexec/electron/chrome_crashpad_handler" "''${gappsWrapperArgs[@]}" - wrapProgram "$out/libexec/electron/chrome-sandbox" "''${gappsWrapperArgs[@]}" - wrapProgram "$out/libexec/electron/electron" "''${gappsWrapperArgs[@]}" \ - --add-flags "--js-flags=--no-decommit-pooled-pages" - '' - else - null; + # We don't want to wrap the contents of $out/libexec automatically + dontWrapGApps = true; + + preFixup = '' + makeWrapper "$out/libexec/electron/electron" $out/bin/electron \ + "''${gappsWrapperArgs[@]}" \ + ${lib.optionalString needsAarch64PageSizeFix "--add-flags '--js-flags=--no-decommit-pooled-pages'"} + ''; postFixup = '' patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${electronLibPath}:$out/libexec/electron" \ - $out/libexec/electron/.electron-wrapped \ - $out/libexec/electron/.chrome_crashpad_handler-wrapped + $out/libexec/electron/electron \ + $out/libexec/electron/chrome_crashpad_handler # patch libANGLE patchelf \