2021-07-18 14:41:04 +00:00
|
|
|
{ lib
|
2022-10-27 20:29:07 +00:00
|
|
|
, buildNpmPackage
|
2021-07-18 14:41:04 +00:00
|
|
|
, copyDesktopItems
|
2023-01-29 05:21:05 +00:00
|
|
|
, electron_22
|
2022-08-01 15:57:53 +00:00
|
|
|
, buildGoModule
|
2021-07-18 14:41:04 +00:00
|
|
|
, esbuild
|
|
|
|
, fetchFromGitHub
|
2022-10-27 18:40:43 +00:00
|
|
|
, fetchpatch
|
2021-07-18 14:41:04 +00:00
|
|
|
, libdeltachat
|
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
2022-03-05 04:47:38 +00:00
|
|
|
, noto-fonts-emoji
|
2021-07-18 14:41:04 +00:00
|
|
|
, pkg-config
|
2022-10-27 20:29:07 +00:00
|
|
|
, python3
|
2022-03-05 04:47:38 +00:00
|
|
|
, roboto
|
2021-08-26 02:15:37 +00:00
|
|
|
, rustPlatform
|
2022-03-05 04:47:38 +00:00
|
|
|
, sqlcipher
|
2021-07-18 14:41:04 +00:00
|
|
|
, stdenv
|
|
|
|
, CoreServices
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-11-16 04:00:29 +00:00
|
|
|
libdeltachat' = libdeltachat.overrideAttrs (old: rec {
|
2023-02-09 16:34:43 +00:00
|
|
|
version = "1.107.1";
|
2021-11-16 04:00:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "deltachat";
|
|
|
|
repo = "deltachat-core-rust";
|
|
|
|
rev = version;
|
2023-02-09 16:34:43 +00:00
|
|
|
hash = "sha256-ISAUZyFrp86ILtRrlowceBQNJ7+tbJReIAe6+u4wwQI=";
|
2021-11-16 04:00:29 +00:00
|
|
|
};
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${old.pname}-${version}";
|
2023-02-09 16:34:43 +00:00
|
|
|
hash = "sha256-B4BMxiI3GhsjeD3gYrq5ZpbZ7l77ycrIMWu2sUzZiz4=";
|
2021-11-16 04:00:29 +00:00
|
|
|
};
|
|
|
|
});
|
2022-08-01 15:57:53 +00:00
|
|
|
esbuild' = esbuild.override {
|
|
|
|
buildGoModule = args: buildGoModule (args // rec {
|
2022-10-27 20:29:07 +00:00
|
|
|
version = "0.14.54";
|
2022-08-01 15:57:53 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evanw";
|
|
|
|
repo = "esbuild";
|
|
|
|
rev = "v${version}";
|
2022-10-27 20:29:07 +00:00
|
|
|
hash = "sha256-qCtpy69ROCspRgPKmCV0YY/EOSWiNU/xwDblU0bQp4w=";
|
2022-08-01 15:57:53 +00:00
|
|
|
};
|
2023-01-09 14:32:57 +00:00
|
|
|
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
2022-08-01 15:57:53 +00:00
|
|
|
});
|
|
|
|
};
|
2022-10-27 20:29:07 +00:00
|
|
|
in buildNpmPackage rec {
|
2021-07-18 14:41:04 +00:00
|
|
|
pname = "deltachat-desktop";
|
2023-02-09 16:34:43 +00:00
|
|
|
version = "1.34.4";
|
2021-07-18 14:41:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "deltachat";
|
|
|
|
repo = "deltachat-desktop";
|
2021-09-08 22:36:34 +00:00
|
|
|
rev = "v${version}";
|
2023-02-09 16:34:43 +00:00
|
|
|
hash = "sha256-LV8/r6psUZuCEGbaH1nWlrkeNbEYG8R5O1aCxECPH1E=";
|
2021-07-18 14:41:04 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 16:34:43 +00:00
|
|
|
npmDepsHash = "sha256-rdZVvsyCo/6C4+gjytCCn9Qcl+chc6U+6orkcM59I8U=";
|
2022-10-27 20:29:07 +00:00
|
|
|
|
2021-07-18 14:41:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
2022-10-27 20:29:07 +00:00
|
|
|
python3
|
2021-07-18 14:41:04 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
copyDesktopItems
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-11-16 04:00:29 +00:00
|
|
|
libdeltachat'
|
2021-07-18 14:41:04 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
CoreServices
|
|
|
|
];
|
|
|
|
|
|
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
2021-12-01 00:48:01 +00:00
|
|
|
ESBUILD_BINARY_PATH = "${esbuild'}/bin/esbuild";
|
2021-07-18 14:41:04 +00:00
|
|
|
USE_SYSTEM_LIBDELTACHAT = "true";
|
|
|
|
VERSION_INFO_GIT_REF = src.rev;
|
|
|
|
|
2022-10-27 20:29:07 +00:00
|
|
|
preBuild = ''
|
2022-04-21 20:13:49 +00:00
|
|
|
rm -r node_modules/deltachat-node/node/prebuilds
|
2022-09-22 15:20:03 +00:00
|
|
|
'';
|
2021-07-18 14:41:04 +00:00
|
|
|
|
2022-10-27 20:29:07 +00:00
|
|
|
npmBuildScript = "build4production";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2021-07-18 14:41:04 +00:00
|
|
|
npm prune --production
|
|
|
|
|
2022-10-27 20:29:07 +00:00
|
|
|
mkdir -p $out/lib/node_modules/deltachat-desktop
|
|
|
|
cp -r . $out/lib/node_modules/deltachat-desktop
|
2022-03-27 18:35:34 +00:00
|
|
|
|
2022-03-05 04:47:38 +00:00
|
|
|
awk '!/^#/ && NF' build/packageignore_list \
|
2022-10-27 20:29:07 +00:00
|
|
|
| xargs -I {} sh -c "rm -rf $out/lib/node_modules/deltachat-desktop/{}" || true
|
|
|
|
|
|
|
|
install -D build/icon.png \
|
|
|
|
$out/share/icons/hicolor/scalable/apps/deltachat.png
|
2022-03-05 04:47:38 +00:00
|
|
|
|
|
|
|
ln -sf ${noto-fonts-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
|
2021-07-18 14:41:04 +00:00
|
|
|
|
2023-01-29 05:21:05 +00:00
|
|
|
makeWrapper ${electron_22}/bin/electron $out/bin/deltachat \
|
2022-03-05 04:47:38 +00:00
|
|
|
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher${stdenv.hostPlatform.extensions.sharedLibrary} \
|
2021-07-18 14:41:04 +00:00
|
|
|
--add-flags $out/lib/node_modules/deltachat-desktop
|
2022-10-27 20:29:07 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-07-18 14:41:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItems = lib.singleton (makeDesktopItem {
|
|
|
|
name = "deltachat";
|
|
|
|
exec = "deltachat %u";
|
|
|
|
icon = "deltachat";
|
|
|
|
desktopName = "Delta Chat";
|
|
|
|
genericName = "Delta Chat";
|
|
|
|
comment = meta.description;
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Network" "InstantMessaging" "Chat" ];
|
|
|
|
startupWMClass = "DeltaChat";
|
2022-10-27 20:29:07 +00:00
|
|
|
mimeTypes = [
|
|
|
|
"x-scheme-handler/openpgp4fpr"
|
|
|
|
"x-scheme-handler/dcaccount"
|
|
|
|
"x-scheme-handler/dclogin"
|
|
|
|
"x-scheme-handler/mailto"
|
|
|
|
];
|
2021-07-18 14:41:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Email-based instant messaging for Desktop";
|
|
|
|
homepage = "https://github.com/deltachat/deltachat-desktop";
|
2022-04-21 20:13:49 +00:00
|
|
|
changelog = "https://github.com/deltachat/deltachat-desktop/blob/${src.rev}/CHANGELOG.md";
|
2021-07-18 14:41:04 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2022-06-07 17:01:38 +00:00
|
|
|
mainProgram = "deltachat";
|
2021-07-18 14:41:04 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|