1{
2 lib,
3 mkDerivation,
4 fetchFromGitHub,
5 cmake,
6 qtbase,
7 qtmultimedia,
8 qtimageformats,
9 qtx11extras,
10 qttools,
11 libidn,
12 qca-qt5,
13 libXScrnSaver,
14 hunspell,
15 libsecret,
16 libgcrypt,
17 libgpg-error,
18 usrsctp,
19 qtkeychain,
20
21 chatType ? "basic", # See the assertion below for available options
22 qtwebkit,
23 qtwebengine,
24
25 enablePlugins ? true,
26 html-tidy,
27 http-parser,
28 libotr,
29 libomemo-c,
30
31 # Voice messages
32 voiceMessagesSupport ? true,
33 gst_all_1,
34 enablePsiMedia ? false,
35 pkg-config,
36}:
37
38assert builtins.elem (lib.toLower chatType) [
39 "basic" # Basic implementation, no web stuff involved
40 "webkit" # Legacy one, based on WebKit (see https://wiki.qt.io/Qt_WebKit)
41 "webengine" # QtWebEngine (see https://wiki.qt.io/QtWebEngine)
42];
43
44assert enablePsiMedia -> enablePlugins;
45
46mkDerivation rec {
47 pname = "psi-plus";
48
49 version = "1.5.2081";
50 src = fetchFromGitHub {
51 owner = "psi-plus";
52 repo = "psi-plus-snapshots";
53 rev = version;
54 sha256 = "sha256-C5EFC6HpUEFb5P3yGAwlhpj7MhS16P6fkKD5GjC3J9I=";
55 };
56
57 cmakeFlags = [
58 "-DCHAT_TYPE=${chatType}"
59 "-DENABLE_PLUGINS=${if enablePlugins then "ON" else "OFF"}"
60 "-DBUILD_PSIMEDIA=${if enablePsiMedia then "ON" else "OFF"}"
61 ];
62
63 nativeBuildInputs = [
64 cmake
65 qttools
66 ]
67 ++ lib.optionals enablePsiMedia [
68 pkg-config
69 ];
70
71 buildInputs = [
72 qtbase
73 qtmultimedia
74 qtimageformats
75 qtx11extras
76 libidn
77 qca-qt5
78 libXScrnSaver
79 hunspell
80 libsecret
81 libgcrypt
82 libgpg-error
83 usrsctp
84 qtkeychain
85 ]
86 ++ lib.optionals voiceMessagesSupport [
87 gst_all_1.gst-plugins-base
88 gst_all_1.gst-plugins-good
89 ]
90 ++ lib.optionals enablePlugins [
91 html-tidy
92 http-parser
93 libotr
94 libomemo-c
95 ]
96 ++ lib.optionals (chatType == "webkit") [
97 qtwebkit
98 ]
99 ++ lib.optionals (chatType == "webengine") [
100 qtwebengine
101 ];
102
103 preFixup = lib.optionalString voiceMessagesSupport ''
104 qtWrapperArgs+=(
105 --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
106 )
107 '';
108
109 meta = {
110 homepage = "https://psi-plus.com";
111 description = "XMPP (Jabber) client based on Qt5";
112 mainProgram = "psi-plus";
113 maintainers = with lib.maintainers; [
114 orivej
115 unclechu
116 ];
117 license = lib.licenses.gpl2Only;
118 platforms = lib.platforms.linux;
119 };
120}