about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/quaternion/default.nix
blob: 983646fbad53968ed144e3a3fe5a1c53e8621858 (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
{ stdenv, lib, fetchFromGitHub, fetchpatch, qtbase, qtquickcontrols, cmake, libqmatrixclient }:

stdenv.mkDerivation rec {
  name = "quaternion-${version}";
  version = "0.0.9.2";

  src = fetchFromGitHub {
    owner  = "QMatrixClient";
    repo   = "Quaternion";
    rev    = "v${version}";
    sha256 = "0zrr4khbbdf5ziq65gi0cb1yb1d0y5rv18wld22w1x96f7fkmrib";
  };

  buildInputs = [ qtbase qtquickcontrols ];

  nativeBuildInputs = [ cmake ];

  patches = [
    # https://github.com/QMatrixClient/Quaternion/pull/400
    (fetchpatch {
      url = "https://github.com/QMatrixClient/Quaternion/commit/6cb29834efc343dc2bcf1db62cfad2dc4c121c54.patch";
      sha256 = "0n7mgzzrvx9sa657rfb99i0mjh1k0sn5br344mknqy3wgqdr7s3x";
    })
  ];

  # libqmatrixclient is now compiled as a dynamic library but quarternion cannot use it yet
  # https://github.com/QMatrixClient/Quaternion/issues/239
  postPatch = ''
    rm -rf lib
    ln -s ${libqmatrixclient.src} lib
  '';

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

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