about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/quaternion/default.nix
blob: 2a0bfce75631c5100be0a904298c255a73134ecc (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
{ stdenv
, lib
, fetchFromGitHub
, cmake
, wrapQtAppsHook
, qtbase
, qtquickcontrols2 ? null # only a separate package on qt5
, qtkeychain
, qtmultimedia
, qttools
, libquotient
, libsecret
, olm
}:

let
  inherit (lib) cmakeBool;

in
stdenv.mkDerivation (finalAttrs: {
  pname = "quaternion";
  version = "0.0.96.1";

  src = fetchFromGitHub {
    owner = "quotient-im";
    repo = "Quaternion";
    rev = finalAttrs.version;
    hash = "sha256-lRCSEb/ldVnEv6z0moU4P5rf0ssKb9Bw+4QEssLjuwI=";
  };

  buildInputs = [
    libquotient
    libsecret
    olm
    qtbase
    qtkeychain
    qtmultimedia
    qtquickcontrols2
  ];

  nativeBuildInputs = [ cmake qttools wrapQtAppsHook ];

  # qt6 needs UTF
  env.LANG = "C.UTF-8";

  cmakeFlags = [
    # drop this from 0.0.97 onwards as it will be qt6 only
    (cmakeBool "BUILD_WITH_QT6" ((lib.versions.major qtbase.version) == "6"))
  ];

  postInstall =
    if stdenv.isDarwin then ''
      mkdir -p $out/Applications
      mv $out/bin/quaternion.app $out/Applications
      rmdir $out/bin || :
    '' else ''
      substituteInPlace $out/share/applications/com.github.quaternion.desktop \
        --replace 'Exec=quaternion' "Exec=$out/bin/quaternion"
    '';

  meta = with lib; {
    description = "Cross-platform desktop IM client for the Matrix protocol";
    mainProgram = "quaternion";
    homepage = "https://matrix.org/ecosystem/clients/quaternion/";
    license = licenses.gpl3;
    maintainers = with maintainers; [ peterhoeg ];
    inherit (qtbase.meta) platforms;
  };
})