Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deltachat-desktop: 1.46.8 -> 1.48.0 #355575

Merged
merged 2 commits into from
Nov 18, 2024
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
116 changes: 51 additions & 65 deletions pkgs/by-name/de/deltachat-desktop/package.nix
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
{ lib
, buildNpmPackage
, copyDesktopItems
, electron_30
, buildGoModule
, esbuild
, electron_32
, fetchFromGitHub
, jq
, deltachat-rpc-server
, makeDesktopItem
, makeWrapper
, noto-fonts-color-emoji
, nodejs
, pkg-config
, pnpm_9
, python3
, roboto
, sqlcipher
, stdenv
, darwin
, testers
, deltachat-desktop
, yq
}:

let
electron = electron_30;
esbuild' = esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.19.12";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-NQ06esCSU6YPvQ4cMsi3DEFGIQGl8Ff6fhdTxUAyGvo=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
};
electron = electron_32;
pnpm = pnpm_9;
in
buildNpmPackage rec {
stdenv.mkDerivation (finalAttrs: {
pname = "deltachat-desktop";
version = "1.46.8";
version = "1.48.0";

src = fetchFromGitHub {
owner = "deltachat";
repo = "deltachat-desktop";
rev = "v${version}";
hash = "sha256-17JhaanYEySoDuLYFMc4vB3wVlCucMh3Jk2Uu9PqUdQ=";
rev = "v${finalAttrs.version}";
hash = "sha256-BgB12pHySJIMtBCph5UkBjioMhEYQq9i7htkrWQNlps=";
};

npmDepsHash = "sha256-+74koym1lL2rk5n06i7JgcXmX+yW4zgqRfdH6ryXe0s=";
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-YBfHVZB6TScIKbWQrN1KJYSUZytR81UwKZ87GaxGlZ8=";
};

nativeBuildInputs = [
jq
yq
makeWrapper
nodejs
pkg-config
pnpm.configHook
python3
] ++ lib.optionals stdenv.hostPlatform.isLinux [
copyDesktopItems
Expand All @@ -65,55 +55,50 @@ buildNpmPackage rec {

env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
ESBUILD_BINARY_PATH = "${esbuild'}/bin/esbuild";
USE_SYSTEM_LIBDELTACHAT = "true";
VERSION_INFO_GIT_REF = src.rev;
VERSION_INFO_GIT_REF = finalAttrs.src.rev;
};

preBuild = ''
buildPhase = ''
runHook preBuild

test \
$(jq -r '.packages."node_modules/@deltachat/jsonrpc-client".version' package-lock.json) \
$(yq -r '.catalogs.default."@deltachat/jsonrpc-client".version' pnpm-lock.yaml) \
= ${deltachat-rpc-server.version} \
|| (echo "error: deltachat-rpc-server version does not match jsonrpc-client" && exit 1)

test \
$(jq -r '.packages."node_modules/electron".version' package-lock.json | grep -E -o "^[0-9]+") \
$(yq -r '.importers."packages/target-electron".devDependencies.electron.version' pnpm-lock.yaml | grep -E -o "^[0-9]+") \
= ${lib.versions.major electron.version} \
|| (echo 'error: electron version doesn not match package-lock.json' && exit 1)

pnpm -w build:electron

dotlambda marked this conversation as resolved.
Show resolved Hide resolved
pnpm --filter=@deltachat-desktop/target-electron pack:generate_config
pnpm --filter=@deltachat-desktop/target-electron pack:patch-node-modules
pnpm --filter=@deltachat-desktop/target-electron exec electron-builder \
--config ./electron-builder.json5 \
dotlambda marked this conversation as resolved.
Show resolved Hide resolved
--dir \
-c.electronDist=${electron.dist} \
-c.electronVersion=${electron.version}

pushd packages/target-electron/dist/*-unpacked/resources/app.asar.unpacked
rm node_modules/@deltachat/stdio-rpc-server-*/deltachat-rpc-server
ln -s ${lib.getExe deltachat-rpc-server} node_modules/@deltachat/stdio-rpc-server-linux-*
'';
ln -s ${lib.getExe deltachat-rpc-server} node_modules/@deltachat/stdio-rpc-server-*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Simon-Laux Does this look like the correct alternative to DELTA_CHAT_RPC_SERVER?

Copy link

@Simon-Laux Simon-Laux Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. I first thought generating a @deltachat/stdio-rpc-server-<os>-<arch>/package.json might be necessary for detection, but looks like it already finds it just fine.

popd

npmBuildScript = "build4production";
runHook postBuild
'';

installPhase = ''
runHook preInstall

npm prune --production

mkdir -p $out/lib/node_modules/deltachat-desktop
cp -r . $out/lib/node_modules/deltachat-desktop

awk '!/^#/ && NF' build/packageignore_list \
| xargs -I {} sh -c "rm -rf $out/lib/node_modules/deltachat-desktop/{}" || true

# required for electron to import index.js as a module
cp package.json $out/lib/node_modules/deltachat-desktop

install -D build/icon.png \
$out/share/icons/hicolor/scalable/apps/deltachat.png

ln -sf ${noto-fonts-color-emoji}/share/fonts/noto/NotoColorEmoji.ttf \
$out/lib/node_modules/deltachat-desktop/html-dist/fonts/noto/emoji
for font in $out/lib/node_modules/deltachat-desktop/html-dist/fonts/Roboto-*.ttf; do
ln -sf ${roboto}/share/fonts/truetype/$(basename $font) \
$out/lib/node_modules/deltachat-desktop/html-dist/fonts
done
mkdir -p $out/opt/DeltaChat
cp -r packages/target-electron/dist/*-unpacked/{locales,resources{,.pak}} $out/opt/DeltaChat

makeWrapper ${lib.getExe electron} $out/bin/deltachat \
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher${stdenv.hostPlatform.extensions.sharedLibrary} \
--add-flags $out/lib/node_modules/deltachat-desktop
makeWrapper ${lib.getExe electron} $out/bin/${finalAttrs.meta.mainProgram} \
--add-flags $out/opt/DeltaChat/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0

runHook postInstall
'';
Expand All @@ -124,7 +109,7 @@ buildNpmPackage rec {
icon = "deltachat";
desktopName = "Delta Chat";
genericName = "Delta Chat";
comment = meta.description;
comment = finalAttrs.meta.description;
categories = [ "Network" "InstantMessaging" "Chat" ];
startupWMClass = "DeltaChat";
mimeTypes = [
Expand All @@ -141,12 +126,13 @@ buildNpmPackage rec {
};
};

meta = with lib; {
meta = {
description = "Email-based instant messaging for Desktop";
homepage = "https://github.com/deltachat/deltachat-desktop";
changelog = "https://github.com/deltachat/deltachat-desktop/blob/${src.rev}/CHANGELOG.md";
license = licenses.gpl3Plus;
changelog = "https://github.com/deltachat/deltachat-desktop/blob/${finalAttrs.src.rev}/CHANGELOG.md";
license = lib.licenses.gpl3Plus;
mainProgram = "deltachat";
maintainers = with maintainers; [ dotlambda ];
maintainers = with lib.maintainers; [ dotlambda ];
platforms = lib.platforms.linux;
};
}
})
Loading
Loading