push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
let
infoJson = builtins.fromJSON (builtins.readFile ./info.json);
in
{ lib, callPackage }:
let
mkElectron = callPackage ./generic.nix { };
in
lib.mapAttrs' (
majorVersion: info:
lib.nameValuePair "electron_${majorVersion}-bin" (mkElectron info.version info.hashes)
) infoJson

View File

@@ -0,0 +1,211 @@
{
lib,
stdenv,
makeWrapper,
fetchurl,
fetchzip,
wrapGAppsHook3,
glib,
gtk3,
gtk4,
unzip,
at-spi2-atk,
libdrm,
libgbm,
libxkbcommon,
libxshmfence,
libGL,
vulkan-loader,
alsa-lib,
cairo,
cups,
dbus,
expat,
gdk-pixbuf,
nss,
nspr,
xorg,
pango,
systemd,
pciutils,
libnotify,
pipewire,
libsecret,
libpulseaudio,
speechd-minimal,
}:
version: hashes:
let
pname = "electron";
meta = with lib; {
description = "Cross platform desktop application shell";
homepage = "https://github.com/electron/electron";
license = licenses.mit;
mainProgram = "electron";
maintainers = with maintainers; [
yayayayaka
teutat3s
tomasajt
];
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 "36.0.0") "Electron version ${version} is EOL";
};
fetcher =
vers: tag: hash:
fetchurl {
url = "https://github.com/electron/electron/releases/download/v${vers}/electron-v${vers}-${tag}.zip";
sha256 = hash;
};
headersFetcher =
vers: hash:
fetchzip {
name = "electron-${vers}-headers";
url = "https://artifacts.electronjs.org/headers/dist/v${vers}/node-v${vers}-headers.tar.gz";
sha256 = hash;
};
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}");
common = platform: {
inherit pname version meta;
src = fetcher version (get tags platform) (get hashes platform);
passthru.headers = headersFetcher version hashes.headers;
};
electronLibPath = lib.makeLibraryPath [
alsa-lib
at-spi2-atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
gtk4
nss
nspr
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxkbfile
pango
pciutils
stdenv.cc.cc
systemd
libnotify
pipewire
libsecret
libpulseaudio
speechd-minimal
libdrm
libgbm
libxkbcommon
libxshmfence
libGL
vulkan-loader
];
linux = finalAttrs: {
buildInputs = [
glib
gtk3
gtk4
];
nativeBuildInputs = [
unzip
makeWrapper
wrapGAppsHook3
];
dontUnpack = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/libexec/electron
unzip -d $out/libexec/electron $src
chmod u-x $out/libexec/electron/*.so*
'';
# We don't want to wrap the contents of $out/libexec automatically
dontWrapGApps = true;
preFixup = ''
makeWrapper "$out/libexec/electron/electron" $out/bin/electron \
"''${gappsWrapperArgs[@]}"
'';
postFixup = ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${electronLibPath}:$out/libexec/electron" \
$out/libexec/electron/electron \
$out/libexec/electron/chrome_crashpad_handler
# patch libANGLE
patchelf \
--set-rpath "${
lib.makeLibraryPath [
libGL
pciutils
vulkan-loader
]
}" \
$out/libexec/electron/lib*GL*
# replace bundled vulkan-loader
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 = finalAttrs: {
nativeBuildInputs = [
makeWrapper
unzip
];
buildCommand = ''
mkdir -p $out/Applications
unzip $src
mv Electron.app $out/Applications
mkdir -p $out/bin
makeWrapper $out/Applications/Electron.app/Contents/MacOS/Electron $out/bin/electron
'';
passthru.dist = finalAttrs.finalPackage + "/Applications";
};
in
stdenv.mkDerivation (
finalAttrs:
lib.recursiveUpdate (common stdenv.hostPlatform) (
(if stdenv.hostPlatform.isDarwin then darwin else linux) finalAttrs
)
)

View File

@@ -0,0 +1,46 @@
{
"35": {
"hashes": {
"aarch64-darwin": "2fe3a3cfad607a8c1627f6f2bb9834f959c665ef575b663206db11929634b92f",
"aarch64-linux": "35c4c30aed2639a38fafa6bd1a6a97b3af89a681afbd5c7a0f40673859040ea3",
"armv7l-linux": "350e80638b5ba8a1b56e2463fa55de25f8ee595c0496ef833b07fb4dc65e0c22",
"headers": "1w8qcgsbii6gizv31i1nkbhaipcr6r1x384wkwnxp60dk9a6cl59",
"x86_64-darwin": "48a426bb5df999dd46c0700261a1a7f572b17581c4c0d1c28afade5ae600cdc9",
"x86_64-linux": "368d155a2189e1056d111d334b712779e77066fce1f5ab935b22c4ef544eaa29"
},
"version": "35.7.5"
},
"36": {
"hashes": {
"aarch64-darwin": "33892aeb000bd7f3f8a102f3bb3111b6fa1e2ccd92cbb5b787c79423e96d61b8",
"aarch64-linux": "55da6f2d692445f0eff0ee898160ff4da2c2d3f1736aff77fcb12c836f19db5e",
"armv7l-linux": "0631d0dc472c412f4c52def18adf6fddc0aefde37e0b15d0611cd4743f9e1e9b",
"headers": "0fv8hz55xk76vksj8sagfhja0xx03ks8awi3sbmlinjb9m02hb9p",
"x86_64-darwin": "8448b9f39e6c540b326b2abfcdfd41349482247b936a72914f9c843478b6597c",
"x86_64-linux": "bab89894ad4336ee8f855de3bb5405ee3d872d90b2ba7b196ac24cbc7a3025b8"
},
"version": "36.9.2"
},
"37": {
"hashes": {
"aarch64-darwin": "82869e916e74cb763c03fefb5fcee1fc99536e597716d4f3a9c716f9c37effab",
"aarch64-linux": "7c76a5147a9870b8bcbd859278148e1e326f98ea6a5dcb3ac2707d39bd22b2d5",
"armv7l-linux": "0d4a49b5f462972173daf6e919664cc04cad7a7d2a96b074cb181ea07bb0cd74",
"headers": "0pxwny0ynvyqb3zqnharc4mkgj6acipqra1jjmf4hbr2a8m5fnc6",
"x86_64-darwin": "258a104f781c50939ec6b45177a6f810da646ade15567a09cf9d14ec81b82cb2",
"x86_64-linux": "02e644d75392a1ea8991106bc77e1db243ee1fc0c23107dc3b253ed545dd4c66"
},
"version": "37.6.0"
},
"38": {
"hashes": {
"aarch64-darwin": "cff178e2cb9ae0d957d43009ef46d249d5594bc107d7704130bc0ce2e234bbd1",
"aarch64-linux": "76116429b368c883f93eb98cbdb053f98d811c35943133fe3cf9b408018ebe2f",
"armv7l-linux": "a4345bb87504b6b2bef29c0dc53b99770b203a7052fd2c5d38fd3e16177d3e68",
"headers": "096wv1fp5m6nlsv11hsa2jj4yr8mb8pjh16s7ip5amj0phlx5783",
"x86_64-darwin": "232a83cb11b37f67dc0683402463ef30ac0309afb8e96f3bc1ea53e72fafa789",
"x86_64-linux": "f0028975282a6f2946797175ac406a95096f29c5dcda98048148668dfa36eff8"
},
"version": "38.2.0"
}
}

View File

@@ -0,0 +1,217 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python -p python3.pkgs.click python3.pkgs.click-log nix
"""
electron updater
A script for updating binary hashes.
It supports the following modes:
| Mode | Description |
|------------- | ----------------------------------------------- |
| `update` | for updating a specific Electron release |
| `update-all` | for updating all electron releases at once |
The `update` command requires a `--version` flag
to specify the major release to be update.
The `update-all` command updates all non-eol major releases.
The `update` and `update-all` commands accept an optional `--commit`
flag to automatically commit the changes for you.
"""
import logging
import os
import subprocess
import sys
import click
import click_log
from typing import Tuple
os.chdir(os.path.dirname(__file__))
sys.path.append("..")
from update_util import *
# Relatice path to the electron-bin info.json
BINARY_INFO_JSON = "info.json"
# Relative path the the electron-chromedriver info.json
CHROMEDRIVER_INFO_JSON = "../chromedriver/info.json"
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
systems = {
"i686-linux": "linux-ia32",
"x86_64-linux": "linux-x64",
"armv7l-linux": "linux-armv7l",
"aarch64-linux": "linux-arm64",
"x86_64-darwin": "darwin-x64",
"aarch64-darwin": "darwin-arm64",
}
def get_shasums256(version: str) -> list:
"""Returns the contents of SHASUMS256.txt"""
try:
called_process: subprocess.CompletedProcess = subprocess.run(
[
"nix-prefetch-url",
"--print-path",
f"https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt",
],
capture_output=True,
check=True,
text=True,
)
hash_file_path = called_process.stdout.split("\n")[1]
with open(hash_file_path, "r") as f:
return f.read().split("\n")
except subprocess.CalledProcessError as err:
print(err.stderr)
sys.exit(1)
def get_headers(version: str) -> str:
"""Returns the hash of the release headers tarball"""
try:
called_process: subprocess.CompletedProcess = subprocess.run(
[
"nix-prefetch-url",
"--unpack",
f"https://artifacts.electronjs.org/headers/dist/v{version}/node-v{version}-headers.tar.gz",
],
capture_output=True,
check=True,
text=True,
)
return called_process.stdout.split("\n")[0]
except subprocess.CalledProcessError as err:
print(err.stderr)
sys.exit(1)
def get_electron_hashes(major_version: str) -> dict:
"""Returns a dictionary of hashes for a given major version"""
m, _ = get_latest_version(major_version)
version: str = m["version"]
out = {}
out[major_version] = {
"hashes": {},
"version": version,
}
hashes: list = get_shasums256(version)
for nix_system, electron_system in systems.items():
filename = f"*electron-v{version}-{electron_system}.zip"
if any([x.endswith(filename) for x in hashes]):
out[major_version]["hashes"][nix_system] = [
x.split(" ")[0] for x in hashes if x.endswith(filename)
][0]
out[major_version]["hashes"]["headers"] = get_headers(version)
return out
def get_chromedriver_hashes(major_version: str) -> dict:
"""Returns a dictionary of hashes for a given major version"""
m, _ = get_latest_version(major_version)
version: str = m["version"]
out = {}
out[major_version] = {
"hashes": {},
"version": version,
}
hashes: list = get_shasums256(version)
for nix_system, electron_system in systems.items():
filename = f"*chromedriver-v{version}-{electron_system}.zip"
if any([x.endswith(filename) for x in hashes]):
out[major_version]["hashes"][nix_system] = [
x.split(" ")[0] for x in hashes if x.endswith(filename)
][0]
out[major_version]["hashes"]["headers"] = get_headers(version)
return out
def update_binary(major_version: str, commit: bool, chromedriver: bool) -> None:
"""Update a given electron-bin or chromedriver release
Args:
major_version: The major version number, e.g. '27'
commit: Whether the updater should commit the result
"""
if chromedriver:
json_path=CHROMEDRIVER_INFO_JSON
package_name = f"electron-chromedriver_{major_version}"
update_fn=get_chromedriver_hashes
else:
json_path=BINARY_INFO_JSON
package_name = f"electron_{major_version}-bin"
update_fn = get_electron_hashes
print(f"Updating {package_name}")
old_info = load_info_json(json_path)
new_info = update_fn(major_version)
out = old_info | new_info
save_info_json(json_path, out)
old_version = (
old_info[major_version]["version"] if major_version in old_info else None
)
new_version = new_info[major_version]["version"]
if old_version == new_version:
print(f"{package_name} is up-to-date")
elif commit:
commit_result(package_name, old_version, new_version, json_path)
@click.group()
def cli() -> None:
"""A script for updating electron-bin and chromedriver hashes"""
pass
@cli.command("update-chromedriver", help="Update a single major release")
@click.option("-v", "--version", help="The major version, e.g. '23'")
@click.option("-c", "--commit", is_flag=True, default=False, help="Commit the result")
def update_chromedriver(version: str, commit: bool) -> None:
update_binary(version, commit, True)
@cli.command("update", help="Update a single major release")
@click.option("-v", "--version", required=True, type=str, help="The major version, e.g. '23'")
@click.option("-c", "--commit", is_flag=True, default=False, help="Commit the result")
def update(version: str, commit: bool) -> None:
update_binary(version, commit, False)
update_binary(version, commit, True)
@cli.command("update-all", help="Update all releases at once")
@click.option("-c", "--commit", is_flag=True, default=False, help="Commit the result")
def update_all(commit: bool) -> None:
# Filter out releases that have reached end-of-life
filtered_bin_info = dict(
filter(
lambda entry: int(entry[0]) in supported_version_range(),
load_info_json(BINARY_INFO_JSON).items(),
)
)
for major_version, _ in filtered_bin_info.items():
update_binary(str(major_version), commit, False)
update_binary(str(major_version), commit, True)
if __name__ == "__main__":
cli()