about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/psi-plus/default.nix
blob: fae4eff734e2da36205069a0f46b3e33f7c7f5d4 (plain) (blame)
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
{ lib
, mkDerivation
, fetchFromGitHub
, cmake
, qtbase
, qtmultimedia
, qtx11extras
, qttools
, libidn
, qca-qt5
, libXScrnSaver
, hunspell
, libsecret
, libgcrypt
, libotr
, html-tidy
, libgpg-error
, libsignal-protocol-c
, usrsctp

, chatType ? "basic" # See the assertion below for available options
, qtwebkit
, qtwebengine

, enablePlugins ? true

  # Voice messages
, voiceMessagesSupport ? true
, gst_all_1

, enablePsiMedia ? false
, pkg-config
}:

assert builtins.elem (lib.toLower chatType) [
  "basic" # Basic implementation, no web stuff involved
  "webkit" # Legacy one, based on WebKit (see https://wiki.qt.io/Qt_WebKit)
  "webengine" # QtWebEngine (see https://wiki.qt.io/QtWebEngine)
];

assert enablePsiMedia -> enablePlugins;

mkDerivation {
  pname = "psi-plus";

  # Version mask is “X.X.XXXX-R” where “X.X.XXXX” is a mandatory version of Psi
  # and “-R” ending is optional revision number.
  #
  # The “psi-plus-snapshots” generally provides snapshots of these separate
  # repositories glued together (there are also dependencies/libraries):
  #
  # 1. Psi
  # 2. Plugins pack for Psi
  # 3. “psimedia” plugin
  # 4. Resources for Psi (icons, skins, sounds)
  #
  # “X.X.XXXX” is literally a version of Psi.
  # So often when for instance plugins are updated separately a new snapshot is
  # created. And that snapshot would also be linked to “X.X.XXXX” version.
  # So many commits may have the same associated version of the snapshot.
  # But mind that only one Git tag is created for “X.X.XXXX” version.
  #
  # It’s not yet defined in the Psi+ project what value to use as a version for
  # any further releases that don’t change Psi version.
  #
  # Let’s do what Debian does for instance (appends “-R” where “R” is a revision
  # number).
  # E.g. https://tracker.debian.org/news/1226321/psi-plus-14554-5-migrated-to-testing/
  #
  # This has been communicated with the Psi+ main devs in this XMPP MUC chat:
  # psi-dev@conference.jabber.ru
  #
  version = "1.5.1556-2";

  src = fetchFromGitHub {
    owner = "psi-plus";
    repo = "psi-plus-snapshots";
    rev = "635879010b6697f7041a7bbea1853a1f4673c7f7";
    sha256 = "18xvljcm0a9swkyz4diwxi4xaj0w27jnhfgpi8fv5fj11j0g1b3a";
  };

  cmakeFlags = [
    "-DCHAT_TYPE=${chatType}"
    "-DENABLE_PLUGINS=${if enablePlugins then "ON" else "OFF"}"
    "-DBUILD_PSIMEDIA=${if enablePsiMedia then "ON" else "OFF"}"
  ];

  nativeBuildInputs = [
    cmake
    qttools
  ] ++ lib.optionals enablePsiMedia [
    pkg-config
  ];

  buildInputs = [
    qtbase
    qtmultimedia
    qtx11extras
    libidn
    qca-qt5
    libXScrnSaver
    hunspell
    libsecret
    libgcrypt
    libotr
    html-tidy
    libgpg-error
    libsignal-protocol-c
    usrsctp
  ] ++ lib.optionals voiceMessagesSupport [
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
  ] ++ lib.optionals (chatType == "webkit") [
    qtwebkit
  ] ++ lib.optionals (chatType == "webengine") [
    qtwebengine
  ];

  preFixup = lib.optionalString voiceMessagesSupport ''
    qtWrapperArgs+=(
      --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
    )
  '';

  meta = with lib; {
    homepage = "https://psi-plus.com";
    description = "XMPP (Jabber) client based on Qt5";
    maintainers = with maintainers; [ orivej misuzu unclechu ];
    license = licenses.gpl2Only;
    platforms = platforms.linux;
  };
}