Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkgs/development/tools/electron/binary/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ let
]
);

# Fix read out of range on aarch64 16k pages builds
# https://github.com/NixOS/nixpkgs/pull/365364
# https://github.com/NixOS/nixpkgs/pull/380991
# Can likely be removed when v34.2.1 (or v32.3.0?) releases:
# https://github.com/electron/electron/pull/45571
needsAarch64PageSizeFix = lib.versionAtLeast version "34" && stdenv.hostPlatform.isAarch64;

linux = finalAttrs: {
buildInputs = [
glib
Expand All @@ -153,6 +160,19 @@ let
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;

postFixup = ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
Expand Down