Skip to content

Commit ffaace8

Browse files
author
Marcin Mazurek
authored
Merge pull request #3124 from input-output-hk/chore/ddw-1213-update-electron
[DDW-1213] Upgrade Electron to 24.2, and Node.js to 18.×
2 parents 86f0d1d + 9105b4e commit ffaace8

18 files changed

+786
-266
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Chores
1010

11+
- Upgraded Electron to 24.2, and Node.js to 18.× ([PR 3124](https://github.com/input-output-hk/daedalus/pull/3124))
1112
- Defined a proxy for currency conversions ([PR 3121](https://github.com/input-output-hk/daedalus/pull/3121))
1213
- Switched Daedalus to be built with Nix flakes ([PR 3008](https://github.com/input-output-hk/daedalus/pull/3008))
1314
- Update `cardano-wallet` to `v2023-04-14` ([PR 3104](https://github.com/input-output-hk/daedalus/pull/3104))

installers/common/WindowsInstaller.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,15 @@ writeInstallerNSIS outName (Version fullVersion') InstallerConfig{installDirecto
241241
file [] "cardano-launcher.exe"
242242
file [] "libffi-8.dll"
243243
file [] "libgmp-10.dll"
244+
file [] "libstdc++-6.dll"
245+
file [] "mcfgthread-12.dll"
246+
file [] "libgcc_s_seh-1.dll"
244247
--file [] "cardano-x509-certificates.exe"
245248
--file [] "log-config-prod.yaml"
246249
--file [] "wallet-topology.yaml"
247250
--file [] "configuration.yaml"
248251
--file [] "*genesis*.json"
249252
file [] "launcher-config.yaml"
250-
file [Recursive] "dlls\\"
251253
file [Recursive] "..\\release\\win32-x64\\$SpacedName-win32-x64\\"
252254

253255
mapM_ unsafeInject

nix/any-darwin.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ in rec {
7777
find . -type f -name '*.node' -not -path '*/@swc*/*' -exec rm -vf {} ';'
7878
7979
patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
80-
sed -r 's#/bin/sh#sh#' -i node_modules/lzma-native/node_modules/node-gyp-build/bin.js
81-
82-
# GNU sed is a bit different:
83-
sed -r "s#sed -i '''#sed -i#" -i node_modules/lzma-native/liblzma-config.sh
8480
8581
# And now, with correct shebangs, run the install scripts (we have to do that
8682
# semi-manually, because another `yarn install` will overwrite those shebangs…):
@@ -294,8 +290,8 @@ in rec {
294290
url = "https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-darwin-${archSuffix}.zip";
295291
hash =
296292
if archSuffix == "x64"
297-
then "sha256-a/CXlNbwILuq+AandY2hJRN7PJZkb0UD64G5VB5Q4C8="
298-
else "sha256-N03fBYF5SzHu6QCCgXL5IYGTwDLA5Gv/z6xq7JXCLxo=";
293+
then "sha256-I/d/vecsrYMV59Nw2SnNzrVAj1UzSUJB/F3VA9itDNw="
294+
else "sha256-Up0HRemSeMZvYxyB7b7yKlrYhxMyNmAC7dNxtAmFCyQ=";
299295
};
300296

301297
electronChromedriver = pkgs.fetchurl {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c
2+
index fd5900704d..f9106fdbe5 100644
3+
--- a/src/libsystemd/sd-device/device-monitor.c
4+
+++ b/src/libsystemd/sd-device/device-monitor.c
5+
@@ -445,9 +445,9 @@ int device_monitor_receive_device(sd_device_monitor *m, sd_device **ret) {
6+
"sd-device-monitor: No sender credentials received, message ignored.");
7+
8+
cred = (struct ucred*) CMSG_DATA(cmsg);
9+
- if (cred->uid != 0)
10+
- return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN),
11+
- "sd-device-monitor: Sender uid="UID_FMT", message ignored.", cred->uid);
12+
+ //if (cred->uid != 0)
13+
+ // return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN),
14+
+ // "sd-device-monitor: Sender uid="UID_FMT", message ignored.", cred->uid);
15+
16+
if (streq(buf.raw, "libudev")) {
17+
/* udev message needs proper version magic */

nix/new-common.nix

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
@@ -50,8 +55,8 @@ rec {
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
}

nix/old-default.nix

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ let
88
system = {
99
x86_64-windows = "x86_64-linux"; # Windows can only be cross-built from Linux now
1010
}.${target} or target;
11-
pkgs = inputs.nixpkgs.legacyPackages.${system};
11+
pkgs =
12+
if target != "x86_64-linux"
13+
then inputs.nixpkgs.legacyPackages.${system}
14+
else import inputs.nixpkgs {
15+
inherit system;
16+
config.packageOverrides = super: {
17+
# XXX: non-root users need to be able to use sd-device/device-monitor.c to detect Ledger:
18+
# FIXME: find the correct (minimal) place to override this:
19+
systemd = super.systemd.overrideAttrs (oldAttrs: {
20+
patches = oldAttrs.patches ++ [./libsystemd--device-monitor.patch];
21+
});
22+
};
23+
};
1224
walletFlake = (import inputs.flake-compat {
1325
# FIXME: add patches in `flake.nix` after <https://github.com/NixOS/nix/issues/3920>
1426
src = pkgs.runCommand "cardano-wallet" {} ''

nix/windows-usb-libs.zip

-2.47 MB
Binary file not shown.

nix/x86_64-linux.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ in rec {
5757
find . -type f -name '*.node' -not -path '*/@swc*/*' -exec rm -vf {} ';'
5858
5959
patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
60-
sed -r 's#/bin/sh#sh#' -i node_modules/lzma-native/node_modules/node-gyp-build/bin.js
6160
6261
# And now, with correct shebangs, run the install scripts (we have to do that
6362
# semi-manually, because another `yarn install` will overwrite those shebangs…):
@@ -102,7 +101,7 @@ in rec {
102101
patchedPackageJson = pkgs.writeText "package.json" (builtins.toJSON (
103102
pkgs.lib.recursiveUpdate originalPackageJson {
104103
productName = oldCode.launcherConfigs.installerConfig.spacedName;
105-
main = "main/index.js";
104+
main = "dist/main/index.js";
106105
}
107106
));
108107
buildPhase = ''
@@ -119,6 +118,9 @@ in rec {
119118
cp -R dist/. $out/share/daedalus/.
120119
cp $patchedPackageJson $out/share/daedalus/package.json
121120
121+
chmod +w $out/share/daedalus/package.json
122+
sed -r 's,"dist/main/index.js","main/index.js",g' -i $out/share/daedalus/package.json
123+
122124
# XXX: the webpack utils embed the original source paths into map files, which causes the derivation
123125
# to depend on the original inputs at the nix layer, and double the size of the linux installs.
124126
# this will just replace all storepaths with an invalid one:
@@ -309,7 +311,7 @@ in rec {
309311
linuxSources = {
310312
electron = pkgs.fetchurl {
311313
url = "https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-linux-x64.zip";
312-
hash = "sha256-dgdCKkuoDNpL1/77L74vTguac9uS4egtwBASqFtdDSs=";
314+
hash = "sha256-jXeA3Sr8/l6Uos9XT0+hCiosaRIndx/KSQUcUkrGdRM=";
313315
};
314316

315317
electronChromedriver = pkgs.fetchurl {

0 commit comments

Comments
 (0)