1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
{ lib
, buildNpmPackage
, copyDesktopItems
, electron_22
, buildGoModule
, esbuild
, fetchFromGitHub
, fetchpatch
, libdeltachat
, makeDesktopItem
, makeWrapper
, noto-fonts-emoji
, pkg-config
, python3
, roboto
, rustPlatform
, sqlcipher
, stdenv
, CoreServices
}:
let
libdeltachat' = libdeltachat.overrideAttrs (old: rec {
version = "1.112.8";
src = fetchFromGitHub {
owner = "deltachat";
repo = "deltachat-core-rust";
rev = "v${version}";
hash = "sha256-bvXZtgFZx94Sw9Tst620HAhi9kmG8PjtWnghdw2ZF84=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"email-0.0.21" = "sha256-Ys47MiEwVZenRNfenT579Rb17ABQ4QizVFTWUq3+bAY=";
"encoded-words-0.2.0" = "sha256-KK9st0hLFh4dsrnLd6D8lC6pRFFs8W+WpZSGMGJcosk=";
"lettre-0.9.2" = "sha256-+hU1cFacyyeC9UGVBpS14BWlJjHy90i/3ynMkKAzclk=";
"quinn-proto-0.9.2" = "sha256-N1gD5vMsBEHO4Fz4ZYEKZA8eE/VywXNXssGcK6hjvpg=";
};
};
});
esbuild' = esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.14.54";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-qCtpy69ROCspRgPKmCV0YY/EOSWiNU/xwDblU0bQp4w=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
};
in buildNpmPackage rec {
pname = "deltachat-desktop";
version = "1.36.4";
src = fetchFromGitHub {
owner = "deltachat";
repo = "deltachat-desktop";
rev = "v${version}";
hash = "sha256-nJF8DPauhEoKC7mibpMJCGsgt9HnwkZp/jiWEEhShBs=";
};
npmDepsHash = "sha256-cTvNU4LO74pcw4Ybo9iftEis2yDA2SqGtrs4v+xAi5c=";
nativeBuildInputs = [
makeWrapper
pkg-config
python3
] ++ lib.optionals stdenv.isLinux [
copyDesktopItems
];
buildInputs = [
libdeltachat'
] ++ lib.optionals stdenv.isDarwin [
CoreServices
];
env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
ESBUILD_BINARY_PATH = "${esbuild'}/bin/esbuild";
USE_SYSTEM_LIBDELTACHAT = "true";
VERSION_INFO_GIT_REF = src.rev;
};
preBuild = ''
rm -r node_modules/deltachat-node/node/prebuilds
'';
npmBuildScript = "build4production";
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
install -D build/icon.png \
$out/share/icons/hicolor/scalable/apps/deltachat.png
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
makeWrapper ${electron_22}/bin/electron $out/bin/deltachat \
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher${stdenv.hostPlatform.extensions.sharedLibrary} \
--add-flags $out/lib/node_modules/deltachat-desktop
runHook postInstall
'';
desktopItems = lib.singleton (makeDesktopItem {
name = "deltachat";
exec = "deltachat %u";
icon = "deltachat";
desktopName = "Delta Chat";
genericName = "Delta Chat";
comment = meta.description;
categories = [ "Network" "InstantMessaging" "Chat" ];
startupWMClass = "DeltaChat";
mimeTypes = [
"x-scheme-handler/openpgp4fpr"
"x-scheme-handler/dcaccount"
"x-scheme-handler/dclogin"
"x-scheme-handler/mailto"
];
});
meta = with lib; {
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;
mainProgram = "deltachat";
maintainers = with maintainers; [ dotlambda ];
};
}
|