fix(nix): Remove hardcoded hash in electron headers handling in desktop.nix

Remove hardcoded hash and use electron.headers directly instead.

Fixes #61443
This commit is contained in:
Fabian Schmitthenner 2026-07-10 00:50:56 +02:00 • committed by alt-glitch
parent cbc1054e23
commit 64f1784e0a

View file

@ -29,11 +29,6 @@ let
packageJson = builtins.fromJSON (builtins.readFile (npm.src + "/apps/desktop/package.json"));
version = packageJson.version;
electronHeaders = pkgs.fetchurl {
url = "https://artifacts.electronjs.org/headers/dist/v${electron.version}/node-v${electron.version}-headers.tar.gz";
sha256 = "sha256-zi/QMwRZ0+FwE9XTE+DiSIeJXAwxmLKEaBWD5W3pMOI=";
};
# node-pty ships no Electron-tagged prebuild we can trust to match this
# exact nixpkgs electron version, so it's always compiled from source
# against Electron's own headers (not whatever Node ran `npm`).
@ -80,18 +75,11 @@ let
# build the electron bundle
node scripts/bundle-electron-main.mjs
# Compile node-pty against Electron's actual ABI (the nixpkgs
# `electron` we ship). Headers come from a pinned fetchurl input
# since the sandbox has no network here, so node-gyp's
# normal --disturl download path can't run.
mkdir -p "$TMPDIR/electron-headers"
tar -xzf ${electronHeaders} -C "$TMPDIR/electron-headers" --strip-components=1
npm rebuild node-pty \
--build-from-source \
--runtime=electron \
--target=${electron.version} \
--nodedir="$TMPDIR/electron-headers" \
--nodedir="${electron.headers}" \
--disturl="" \
--offline