1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 wrapQtAppsHook,
7 qtbase,
8 qtquickcontrols2 ? null, # only a separate package on qt5
9 qtkeychain,
10 qtmultimedia,
11 qttools,
12 libquotient,
13 libsecret,
14 olm,
15}:
16
17let
18 inherit (lib) cmakeBool;
19
20in
21stdenv.mkDerivation (finalAttrs: {
22 pname = "quaternion";
23 version = "0.0.96.1";
24
25 src = fetchFromGitHub {
26 owner = "quotient-im";
27 repo = "Quaternion";
28 rev = finalAttrs.version;
29 hash = "sha256-lRCSEb/ldVnEv6z0moU4P5rf0ssKb9Bw+4QEssLjuwI=";
30 };
31
32 buildInputs = [
33 libquotient
34 libsecret
35 olm
36 qtbase
37 qtkeychain
38 qtmultimedia
39 qtquickcontrols2
40 ];
41
42 nativeBuildInputs = [
43 cmake
44 qttools
45 wrapQtAppsHook
46 ];
47
48 # qt6 needs UTF
49 env.LANG = "C.UTF-8";
50
51 cmakeFlags = [
52 # drop this from 0.0.97 onwards as it will be qt6 only
53 (cmakeBool "BUILD_WITH_QT6" ((lib.versions.major qtbase.version) == "6"))
54 ];
55
56 postInstall =
57 if stdenv.hostPlatform.isDarwin then
58 ''
59 mkdir -p $out/Applications
60 mv $out/bin/quaternion.app $out/Applications
61 rmdir $out/bin || :
62 ''
63 else
64 ''
65 substituteInPlace $out/share/applications/com.github.quaternion.desktop \
66 --replace 'Exec=quaternion' "Exec=$out/bin/quaternion"
67 '';
68
69 meta = with lib; {
70 description = "Cross-platform desktop IM client for the Matrix protocol";
71 mainProgram = "quaternion";
72 homepage = "https://matrix.org/ecosystem/clients/quaternion/";
73 license = licenses.gpl3;
74 maintainers = with maintainers; [ peterhoeg ];
75 inherit (qtbase.meta) platforms;
76 };
77})