1{
2 mkDerivation,
3 lib,
4 stdenv,
5 fetchFromGitHub,
6 qtbase,
7 qtquickcontrols,
8 qmake,
9 makeDesktopItem,
10}:
11
12# we now have libqmatrixclient so a future version of tensor that supports it
13# should use that
14
15mkDerivation rec {
16 pname = "tensor";
17 version = "unstable-2017-02-21";
18
19 src = fetchFromGitHub {
20 owner = "davidar";
21 repo = "tensor";
22 rev = "f3f3056d770d7fb4a21c610cee7936ee900569f5";
23 hash = "sha256-aR6TsfUxsxoSDaIWYgRCwd7BCgekSEqY6LpDoQ5DNqY=";
24 fetchSubmodules = true;
25 };
26
27 buildInputs = [
28 qtbase
29 qtquickcontrols
30 ];
31 nativeBuildInputs = [ qmake ];
32
33 desktopItem = makeDesktopItem {
34 name = "tensor";
35 exec = "@bin@";
36 icon = "tensor.png";
37 comment = meta.description;
38 desktopName = "Tensor Matrix Client";
39 genericName = meta.description;
40 categories = [
41 "Chat"
42 "Utility"
43 ];
44 mimeTypes = [ "application/x-chat" ];
45 };
46
47 installPhase =
48 if stdenv.hostPlatform.isDarwin then
49 ''
50 runHook preInstall
51
52 mkdir -p $out/Applications
53 cp -r tensor.app $out/Applications/tensor.app
54
55 runHook postInstall
56 ''
57 else
58 ''
59 runHook preInstall
60
61 install -Dm755 tensor $out/bin/tensor
62 install -Dm644 client/logo.png \
63 $out/share/icons/hicolor/512x512/apps/tensor.png
64 install -Dm644 ${desktopItem}/share/applications/tensor.desktop \
65 $out/share/applications/tensor.desktop
66
67 substituteInPlace $out/share/applications/tensor.desktop \
68 --subst-var-by bin $out/bin/tensor
69
70 runHook postInstall
71 '';
72
73 meta = with lib; {
74 homepage = "https://github.com/davidar/tensor";
75 description = "Cross-platform Qt5/QML-based Matrix client";
76 mainProgram = "tensor";
77 license = licenses.gpl3;
78 maintainers = with maintainers; [ peterhoeg ];
79 inherit (qtbase.meta) platforms;
80 };
81}