@@ -30,14 +30,19 @@ rec {
3030 # patches = pkgs.lib.optional pkgs.stdenv.isDarwin (njPath + "/bypass-xcodebuild.diff");
3131 # };
3232
33- nodejs = pkgs . nodejs-14_x . overrideAttrs ( drv : {
34- # XXX: we don’t want `bypass-xcodebuild.diff`, rather we supply
33+ nodejs = let
34+ base = pkgs . nodejs-18_x ;
35+ in if ! ( pkgs . lib . hasInfix "-darwin" targetSystem ) then base else base . overrideAttrs ( drv : {
36+ # XXX: we don’t want `bypass-xcodebuild.diff` or `bypass-darwin-xcrun-node16.patch`, rather we supply
3537 # the pure `xcbuild` – without that, `blake2` doesn’t build,
3638 # cf. <https://github.com/NixOS/nixpkgs/blob/29ae6a1f3d7a8886b3772df4dc42a13817875c7d/pkgs/development/web/nodejs/bypass-xcodebuild.diff>
37- patches = [ ] ;
39+ patches = pkgs . lib . filter ( patch : ! (
40+ pkgs . lib . hasInfix "bypass-xcodebuild" patch ||
41+ pkgs . lib . hasInfix "bypass-darwin-xcrun" patch
42+ ) ) drv . patches ;
3843 } ) ;
3944
40- nodePackages = pkgs . nodePackages . override { nodejs = nodejs ; } ;
45+ nodePackages = pkgs . nodePackages . override { inherit nodejs ; } ;
4146
4247 yarn = ( pkgs . yarn . override { inherit nodejs ; } ) . overrideAttrs ( drv : {
4348 # XXX: otherwise, unable to run our package.json scripts in Nix sandbox (patchShebangs doesn’t catch this)
5055 # Nixpkgs master @ 2022-07-18
5156 # Why → newer `yarn2nix` uses `deep-equal` to see if anything changed in the lockfile, we need that.
5257 source = pkgs . fetchzip {
53- url = "https://github.com/NixOS/nixpkgs/archive/qe4d49de45a3b5dbcb881656b4e3986e666141ea9 .tar.gz" ;
54- sha256 = "0y0c9ybkcfmjgrl93wzzlk7ii95kh2fb4v5ac5w6rmcsq2ff3yaz " ;
58+ url = "https://github.com/NixOS/nixpkgs/archive/e4d49de45a3b5dbcb881656b4e3986e666141ea9 .tar.gz" ;
59+ hash = "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg= " ;
5560 } ;
5661 subdir = builtins . path { path = source + "/pkgs/development/tools/yarn2nix-moretea/yarn2nix" ; } ;
5762 in
@@ -135,7 +140,7 @@ rec {
135140 # XXX: don’t use fetchzip, we need the raw .tar.gz in `patchElectronRebuild` below
136141 src = pkgs . fetchurl {
137142 url = "https://electronjs.org/headers/v${ electronVersion } /node-v${ electronVersion } -headers.tar.gz" ;
138- hash = "sha256-+FZ1EYV6tiZZUFulFYtq1pr861EhBaMlHRgP5H9ENmw =" ;
143+ hash = "sha256-er08CKt3fwotSjYxqdzpm8Q0YjvD1PhfNBDZ3Jozsvk =" ;
139144 } ;
140145 } ''
141146 tar -xf $src
@@ -144,16 +149,18 @@ rec {
144149 '' ;
145150
146151 electronShaSums = pkgs . fetchurl {
152+ name = "electronShaSums-${ electronVersion } " ; # cache invalidation
147153 url = "https://github.com/electron/electron/releases/download/v${ electronVersion } /SHASUMS256.txt" ;
148- hash = "sha256-NiUplP/dqmynH2ZN97kJVqMkzSLOLi3JR1T/OWHiOiA =" ;
154+ hash = "sha256-75bNqt2c7u/fm0P2Ha6NvkbGThEifIHXl2x5UCdy4fM =" ;
149155 } ;
150156
151157 electronCacheHash = builtins . hashString "sha256"
152158 "https://github.com/electron/electron/releases/download/v${ electronVersion } " ;
153159
154160 electronChromedriverShaSums = pkgs . fetchurl {
161+ name = "electronChromedriverShaSums-${ electronChromedriverVersion } " ; # cache invalidation
155162 url = "https://github.com/electron/electron/releases/download/v${ electronChromedriverVersion } /SHASUMS256.txt" ;
156- sha256 = "07xxam8dvn1aixvx39gd5x3yc1bs6i599ywxwi5cbkpf957ilpcx " ;
163+ hash = "sha256-nV0aT0nuzsVK5J37lEo0egXmRy/tpdF3jyrY3VBVvR8= " ;
157164 } ;
158165
159166 electronChromedriverCacheHash = builtins . hashString "sha256"
@@ -176,20 +183,20 @@ rec {
176183 patchElectronRebuild = pkgs . writeShellScriptBin "patch-electron-rebuild" ''
177184 echo 'Patching electron-rebuild to force our Node.js headers…'
178185
179- nodeGypJs=lib/src/module-type/node-gyp.js
180- if [ ! -e $nodeGypJs ] ; then
181- # makes it work both here, and in shell.nix:
182- nodeGypJs="node_modules/electron-rebuild/$nodeGypJs"
183- fi
184- if [ ! -e $nodeGypJs ] ; then
185- echo >&2 'fatal: shouldn’t happen unless electron-rebuild changes'
186- exit 1
187- fi
186+ tarball="'' ${1:-${ commonSources . electronHeaders . src } }"
187+ nodedir="'' ${2:-${ commonSources . electronHeaders } }"
188+
189+ echo " → tarball=$tarball"
190+ echo " → nodedir=$nodedir"
191+
192+ nodeGypJs="node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js"
188193
189194 # Patch idempotently (matters in repetitive shell.nix):
190- if ! grep -qF ${ commonSources . electronHeaders . src } $nodeGypJs ; then
191- sed -r ' s|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push(" --tarball", " ${ commonSources . electronHeaders . src } ", " --nodedir", " ${ commonSources . electronHeaders } " );|' -i $nodeGypJs
195+ if ! grep -qF "$tarball" $nodeGypJs ; then
196+ sed -r " s|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push(' --tarball', '$tarball', ' --nodedir', '$nodedir' );|" -i $nodeGypJs
192197 fi
198+
199+ echo " → result=$(grep -F "const extraNodeGypArgs" $nodeGypJs)"
193200 '' ;
194201
195202}
0 commit comments