Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Chores

- Upgraded Electron to 24.2, and Node.js to 18.× ([PR 3124](https://github.com/input-output-hk/daedalus/pull/3124))
- Defined a proxy for currency conversions ([PR 3121](https://github.com/input-output-hk/daedalus/pull/3121))
- Switched Daedalus to be built with Nix flakes ([PR 3008](https://github.com/input-output-hk/daedalus/pull/3008))
- Update `cardano-wallet` to `v2023-04-14` ([PR 3104](https://github.com/input-output-hk/daedalus/pull/3104))
Expand Down
4 changes: 3 additions & 1 deletion installers/common/WindowsInstaller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,15 @@ writeInstallerNSIS outName (Version fullVersion') InstallerConfig{installDirecto
file [] "cardano-launcher.exe"
file [] "libffi-8.dll"
file [] "libgmp-10.dll"
file [] "libstdc++-6.dll"
file [] "mcfgthread-12.dll"
file [] "libgcc_s_seh-1.dll"
--file [] "cardano-x509-certificates.exe"
--file [] "log-config-prod.yaml"
--file [] "wallet-topology.yaml"
--file [] "configuration.yaml"
--file [] "*genesis*.json"
file [] "launcher-config.yaml"
file [Recursive] "dlls\\"
file [Recursive] "..\\release\\win32-x64\\$SpacedName-win32-x64\\"

mapM_ unsafeInject
Expand Down
8 changes: 2 additions & 6 deletions nix/any-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ in rec {
find . -type f -name '*.node' -not -path '*/@swc*/*' -exec rm -vf {} ';'

patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
sed -r 's#/bin/sh#sh#' -i node_modules/lzma-native/node_modules/node-gyp-build/bin.js

# GNU sed is a bit different:
sed -r "s#sed -i '''#sed -i#" -i node_modules/lzma-native/liblzma-config.sh

# And now, with correct shebangs, run the install scripts (we have to do that
# semi-manually, because another `yarn install` will overwrite those shebangs…):
Expand Down Expand Up @@ -294,8 +290,8 @@ in rec {
url = "https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-darwin-${archSuffix}.zip";
hash =
if archSuffix == "x64"
then "sha256-a/CXlNbwILuq+AandY2hJRN7PJZkb0UD64G5VB5Q4C8="
else "sha256-N03fBYF5SzHu6QCCgXL5IYGTwDLA5Gv/z6xq7JXCLxo=";
then "sha256-I/d/vecsrYMV59Nw2SnNzrVAj1UzSUJB/F3VA9itDNw="
else "sha256-Up0HRemSeMZvYxyB7b7yKlrYhxMyNmAC7dNxtAmFCyQ=";
};

electronChromedriver = pkgs.fetchurl {
Expand Down
17 changes: 17 additions & 0 deletions nix/libsystemd--device-monitor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c
index fd5900704d..f9106fdbe5 100644
--- a/src/libsystemd/sd-device/device-monitor.c
+++ b/src/libsystemd/sd-device/device-monitor.c
@@ -445,9 +445,9 @@ int device_monitor_receive_device(sd_device_monitor *m, sd_device **ret) {
"sd-device-monitor: No sender credentials received, message ignored.");

cred = (struct ucred*) CMSG_DATA(cmsg);
- if (cred->uid != 0)
- return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN),
- "sd-device-monitor: Sender uid="UID_FMT", message ignored.", cred->uid);
+ //if (cred->uid != 0)
+ // return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN),
+ // "sd-device-monitor: Sender uid="UID_FMT", message ignored.", cred->uid);

if (streq(buf.raw, "libudev")) {
/* udev message needs proper version magic */
47 changes: 27 additions & 20 deletions nix/new-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ rec {
# patches = pkgs.lib.optional pkgs.stdenv.isDarwin (njPath + "/bypass-xcodebuild.diff");
# };

nodejs = pkgs.nodejs-14_x.overrideAttrs (drv: {
# XXX: we don’t want `bypass-xcodebuild.diff`, rather we supply
nodejs = let
base = pkgs.nodejs-18_x;
in if !(pkgs.lib.hasInfix "-darwin" targetSystem) then base else base.overrideAttrs (drv: {
# XXX: we don’t want `bypass-xcodebuild.diff` or `bypass-darwin-xcrun-node16.patch`, rather we supply
# the pure `xcbuild` – without that, `blake2` doesn’t build,
# cf. <https://github.com/NixOS/nixpkgs/blob/29ae6a1f3d7a8886b3772df4dc42a13817875c7d/pkgs/development/web/nodejs/bypass-xcodebuild.diff>
patches = [];
patches = pkgs.lib.filter (patch: !(
pkgs.lib.hasInfix "bypass-xcodebuild" patch ||
pkgs.lib.hasInfix "bypass-darwin-xcrun" patch
)) drv.patches;
});

nodePackages = pkgs.nodePackages.override { nodejs = nodejs; };
nodePackages = pkgs.nodePackages.override { inherit nodejs; };

yarn = (pkgs.yarn.override { inherit nodejs; }).overrideAttrs (drv: {
# XXX: otherwise, unable to run our package.json scripts in Nix sandbox (patchShebangs doesn’t catch this)
Expand All @@ -50,8 +55,8 @@ rec {
# Nixpkgs master @ 2022-07-18
# Why → newer `yarn2nix` uses `deep-equal` to see if anything changed in the lockfile, we need that.
source = pkgs.fetchzip {
url = "https://github.com/NixOS/nixpkgs/archive/qe4d49de45a3b5dbcb881656b4e3986e666141ea9.tar.gz";
sha256 = "0y0c9ybkcfmjgrl93wzzlk7ii95kh2fb4v5ac5w6rmcsq2ff3yaz";
url = "https://github.com/NixOS/nixpkgs/archive/e4d49de45a3b5dbcb881656b4e3986e666141ea9.tar.gz";
hash = "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=";
};
subdir = builtins.path { path = source + "/pkgs/development/tools/yarn2nix-moretea/yarn2nix"; };
in
Expand Down Expand Up @@ -135,7 +140,7 @@ rec {
# XXX: don’t use fetchzip, we need the raw .tar.gz in `patchElectronRebuild` below
src = pkgs.fetchurl {
url = "https://electronjs.org/headers/v${electronVersion}/node-v${electronVersion}-headers.tar.gz";
hash = "sha256-+FZ1EYV6tiZZUFulFYtq1pr861EhBaMlHRgP5H9ENmw=";
hash = "sha256-er08CKt3fwotSjYxqdzpm8Q0YjvD1PhfNBDZ3Jozsvk=";
};
} ''
tar -xf $src
Expand All @@ -144,16 +149,18 @@ rec {
'';

electronShaSums = pkgs.fetchurl {
name = "electronShaSums-${electronVersion}"; # cache invalidation
url = "https://github.com/electron/electron/releases/download/v${electronVersion}/SHASUMS256.txt";
hash = "sha256-NiUplP/dqmynH2ZN97kJVqMkzSLOLi3JR1T/OWHiOiA=";
hash = "sha256-75bNqt2c7u/fm0P2Ha6NvkbGThEifIHXl2x5UCdy4fM=";
};

electronCacheHash = builtins.hashString "sha256"
"https://github.com/electron/electron/releases/download/v${electronVersion}";

electronChromedriverShaSums = pkgs.fetchurl {
name = "electronChromedriverShaSums-${electronChromedriverVersion}"; # cache invalidation
url = "https://github.com/electron/electron/releases/download/v${electronChromedriverVersion}/SHASUMS256.txt";
sha256 = "07xxam8dvn1aixvx39gd5x3yc1bs6i599ywxwi5cbkpf957ilpcx";
hash = "sha256-nV0aT0nuzsVK5J37lEo0egXmRy/tpdF3jyrY3VBVvR8=";
};

electronChromedriverCacheHash = builtins.hashString "sha256"
Expand All @@ -176,20 +183,20 @@ rec {
patchElectronRebuild = pkgs.writeShellScriptBin "patch-electron-rebuild" ''
echo 'Patching electron-rebuild to force our Node.js headers…'

nodeGypJs=lib/src/module-type/node-gyp.js
if [ ! -e $nodeGypJs ] ; then
# makes it work both here, and in shell.nix:
nodeGypJs="node_modules/electron-rebuild/$nodeGypJs"
fi
if [ ! -e $nodeGypJs ] ; then
echo >&2 'fatal: shouldn’t happen unless electron-rebuild changes'
exit 1
fi
tarball="''${1:-${commonSources.electronHeaders.src}}"
nodedir="''${2:-${commonSources.electronHeaders}}"

echo " → tarball=$tarball"
echo " → nodedir=$nodedir"

nodeGypJs="node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js"

# Patch idempotently (matters in repetitive shell.nix):
if ! grep -qF ${commonSources.electronHeaders.src} $nodeGypJs ; then
sed -r 's|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push("--tarball", "${commonSources.electronHeaders.src}", "--nodedir", "${commonSources.electronHeaders}");|' -i $nodeGypJs
if ! grep -qF "$tarball" $nodeGypJs ; then
sed -r "s|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push('--tarball', '$tarball', '--nodedir', '$nodedir');|" -i $nodeGypJs
fi

echo " → result=$(grep -F "const extraNodeGypArgs" $nodeGypJs)"
'';

}
14 changes: 13 additions & 1 deletion nix/old-default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ let
system = {
x86_64-windows = "x86_64-linux"; # Windows can only be cross-built from Linux now
}.${target} or target;
pkgs = inputs.nixpkgs.legacyPackages.${system};
pkgs =
if target != "x86_64-linux"
then inputs.nixpkgs.legacyPackages.${system}
else import inputs.nixpkgs {
inherit system;
config.packageOverrides = super: {
# XXX: non-root users need to be able to use sd-device/device-monitor.c to detect Ledger:
# FIXME: find the correct (minimal) place to override this:
systemd = super.systemd.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches ++ [./libsystemd--device-monitor.patch];
});
};
};
walletFlake = (import inputs.flake-compat {
# FIXME: add patches in `flake.nix` after <https://github.com/NixOS/nix/issues/3920>
src = pkgs.runCommand "cardano-wallet" {} ''
Expand Down
Binary file removed nix/windows-usb-libs.zip
Binary file not shown.
8 changes: 5 additions & 3 deletions nix/x86_64-linux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ in rec {
find . -type f -name '*.node' -not -path '*/@swc*/*' -exec rm -vf {} ';'

patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs
sed -r 's#/bin/sh#sh#' -i node_modules/lzma-native/node_modules/node-gyp-build/bin.js

# And now, with correct shebangs, run the install scripts (we have to do that
# semi-manually, because another `yarn install` will overwrite those shebangs…):
Expand Down Expand Up @@ -102,7 +101,7 @@ in rec {
patchedPackageJson = pkgs.writeText "package.json" (builtins.toJSON (
pkgs.lib.recursiveUpdate originalPackageJson {
productName = oldCode.launcherConfigs.installerConfig.spacedName;
main = "main/index.js";
main = "dist/main/index.js";
}
));
buildPhase = ''
Expand All @@ -119,6 +118,9 @@ in rec {
cp -R dist/. $out/share/daedalus/.
cp $patchedPackageJson $out/share/daedalus/package.json

chmod +w $out/share/daedalus/package.json
sed -r 's,"dist/main/index.js","main/index.js",g' -i $out/share/daedalus/package.json

# XXX: the webpack utils embed the original source paths into map files, which causes the derivation
# to depend on the original inputs at the nix layer, and double the size of the linux installs.
# this will just replace all storepaths with an invalid one:
Expand Down Expand Up @@ -309,7 +311,7 @@ in rec {
linuxSources = {
electron = pkgs.fetchurl {
url = "https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-linux-x64.zip";
hash = "sha256-dgdCKkuoDNpL1/77L74vTguac9uS4egtwBASqFtdDSs=";
hash = "sha256-jXeA3Sr8/l6Uos9XT0+hCiosaRIndx/KSQUcUkrGdRM=";
};

electronChromedriver = pkgs.fetchurl {
Expand Down
Loading