electron{,-bin}: add passthru.dist attribute

This commit is contained in:
TomaSajt 2024-05-21 18:35:51 +02:00
parent 1a88164cc0
commit 6ca8d9b06f
No known key found for this signature in database
GPG Key ID: F011163C050122A1
3 changed files with 17 additions and 7 deletions

View File

@ -107,7 +107,7 @@ let
++ lib.optionals (lib.versionAtLeast version "17.0.0") [ libGL vulkan-loader ]
);
linux = {
linux = finalAttrs: {
buildInputs = [ glib gtk3 ];
nativeBuildInputs = [
@ -142,9 +142,11 @@ let
rm "$out/libexec/electron/libvulkan.so.1"
ln -s -t "$out/libexec/electron" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
'';
passthru.dist = finalAttrs.finalPackage + "/libexec/electron";
};
darwin = {
darwin = finalAttrs: {
nativeBuildInputs = [
makeWrapper
unzip
@ -157,9 +159,12 @@ let
mkdir -p $out/bin
makeWrapper $out/Applications/Electron.app/Contents/MacOS/Electron $out/bin/electron
'';
passthru.dist = finalAttrs.finalPackage + "/Applications";
};
in
stdenv.mkDerivation (
(common stdenv.hostPlatform) //
(if stdenv.isDarwin then darwin else linux)
stdenv.mkDerivation (finalAttrs:
lib.recursiveUpdate
(common stdenv.hostPlatform)
((if stdenv.isDarwin then darwin else linux) finalAttrs)
)

View File

@ -27,7 +27,7 @@ let
fetchedDeps = lib.mapAttrs (name: fetchdep) info.deps;
in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
in ((chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
packageName = "electron";
inherit (info) version;
buildTargets = [ "electron:electron_dist_zip" ];
@ -244,4 +244,9 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
hydraPlatforms = lib.optionals (!(hasInfix "alpha" info.version) && !(hasInfix "beta" info.version)) ["aarch64-linux" "x86_64-linux"];
timeout = 172800; # 48 hours (increased from the Hydra default of 10h)
};
})).overrideAttrs (finalAttrs: prevAttrs: {
# this was the only way I could get the package to properly reference itself
passthru = prevAttrs.passthru // {
dist = finalAttrs.finalPackage + "/libexec/electron";
};
})

View File

@ -31,7 +31,7 @@ stdenv.mkDerivation {
passthru = {
unwrapped = electron-unwrapped;
inherit (electron-unwrapped) headers;
inherit (electron-unwrapped) headers dist;
};
inherit (electron-unwrapped) meta;
}