Skip to content

Commit

Permalink
electron-bin: remove no longer needed version conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
emilylange committed Feb 20, 2025
1 parent 19379c0 commit 3670ca8
Showing 1 changed file with 46 additions and 62 deletions.
108 changes: 46 additions & 62 deletions pkgs/development/tools/electron/binary/generic.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
lib,
stdenv,
libXScrnSaver,
makeWrapper,
fetchurl,
wrapGAppsHook3,
Expand Down Expand Up @@ -42,15 +41,13 @@ let
yayayayaka
teutat3s
];
platforms =
[
"x86_64-darwin"
"x86_64-linux"
"armv7l-linux"
"aarch64-linux"
]
++ optionals (versionAtLeast version "11.0.0") [ "aarch64-darwin" ]
++ optionals (versionOlder version "19.0.0") [ "i686-linux" ];
platforms = [
"x86_64-darwin"
"x86_64-linux"
"armv7l-linux"
"aarch64-linux"
"aarch64-darwin"
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
# https://www.electronjs.org/docs/latest/tutorial/electron-timelines
knownVulnerabilities = optional (versionOlder version "32.0.0") "Electron version ${version} is EOL";
Expand All @@ -70,19 +67,13 @@ let
sha256 = hash;
};

tags =
{
x86_64-linux = "linux-x64";
armv7l-linux = "linux-armv7l";
aarch64-linux = "linux-arm64";
x86_64-darwin = "darwin-x64";
}
// lib.optionalAttrs (lib.versionAtLeast version "11.0.0") {
aarch64-darwin = "darwin-arm64";
}
// lib.optionalAttrs (lib.versionOlder version "19.0.0") {
i686-linux = "linux-ia32";
};
tags = {
x86_64-linux = "linux-x64";
armv7l-linux = "linux-armv7l";
aarch64-linux = "linux-arm64";
x86_64-darwin = "darwin-x64";
aarch64-darwin = "darwin-arm64";
};

get = as: platform: as.${platform.system} or (throw "Unsupported system: ${platform.system}");

Expand All @@ -92,44 +83,37 @@ let
passthru.headers = headersFetcher version hashes.headers;
};

electronLibPath = lib.makeLibraryPath (
[
alsa-lib
at-spi2-atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
nss
nspr
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxkbfile
pango
pciutils
stdenv.cc.cc
systemd
]
++ lib.optionals (lib.versionAtLeast version "9.0.0") [
libdrm
libgbm
]
++ lib.optionals (lib.versionOlder version "10.0.0") [ libXScrnSaver ]
++ lib.optionals (lib.versionAtLeast version "11.0.0") [ libxkbcommon ]
++ lib.optionals (lib.versionAtLeast version "12.0.0") [ libxshmfence ]
++ lib.optionals (lib.versionAtLeast version "17.0.0") [
libGL
vulkan-loader
]
);
electronLibPath = lib.makeLibraryPath [
alsa-lib
at-spi2-atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
nss
nspr
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxkbfile
pango
pciutils
stdenv.cc.cc
systemd
libdrm
libgbm
libxkbcommon
libxshmfence
libGL
vulkan-loader
];

# Fix read out of range on aarch64 16k pages builds
# https://github.com/NixOS/nixpkgs/pull/365364
Expand Down Expand Up @@ -178,7 +162,7 @@ let
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${electronLibPath}:$out/libexec/electron" \
$out/libexec/electron/.electron-wrapped \
${lib.optionalString (lib.versionAtLeast version "15.0.0") "$out/libexec/electron/.chrome_crashpad_handler-wrapped"}
$out/libexec/electron/.chrome_crashpad_handler-wrapped
# patch libANGLE
patchelf \
Expand Down

0 comments on commit 3670ca8

Please sign in to comment.