summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/tensor/default.nix
blob: cbc93857c81910d53e13beff3f3e4e775a99eacf (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
{ mkDerivation
, lib
, stdenv
, fetchFromGitHub
, qtbase
, qtquickcontrols
, qmake
, makeDesktopItem
}:

# we now have libqmatrixclient so a future version of tensor that supports it
# should use that

mkDerivation rec {
  pname = "tensor";
  version = "unstable-2017-02-21";

  src = fetchFromGitHub {
    owner = "davidar";
    repo = "tensor";
    rev = "f3f3056d770d7fb4a21c610cee7936ee900569f5";
    sha256 = "sha256-aR6TsfUxsxoSDaIWYgRCwd7BCgekSEqY6LpDoQ5DNqY=";
    fetchSubmodules = true;
  };

  buildInputs = [ qtbase qtquickcontrols ];
  nativeBuildInputs = [ qmake ];

  desktopItem = makeDesktopItem {
    name = "tensor";
    exec = "@bin@";
    icon = "tensor.png";
    comment = meta.description;
    desktopName = "Tensor Matrix Client";
    genericName = meta.description;
    categories = [ "Chat" "Utility" ];
    mimeTypes = [ "application/x-chat" ];
  };

  installPhase = if stdenv.isDarwin then ''
    runHook preInstall

    mkdir -p $out/Applications
    cp -r tensor.app $out/Applications/tensor.app

    runHook postInstall
  '' else ''
    runHook preInstall

    install -Dm755 tensor $out/bin/tensor
    install -Dm644 client/logo.png \
                   $out/share/icons/hicolor/512x512/apps/tensor.png
    install -Dm644 ${desktopItem}/share/applications/tensor.desktop \
                   $out/share/applications/tensor.desktop

    substituteInPlace $out/share/applications/tensor.desktop \
      --subst-var-by bin $out/bin/tensor

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://matrix.org/docs/projects/client/tensor.html";
    description = "Cross-platform Qt5/QML-based Matrix client";
    license = licenses.gpl3;
    maintainers = with maintainers; [ peterhoeg ];
    inherit (qtbase.meta) platforms;
  };
}