summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix
blob: cb4f3e5e5d156f0bc26606ff5e98b2fa8397c6de (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
70
71
72
73
74
{ mkDerivation, lib, fetchFromGitHub, callPackage
, pkg-config, cmake, ninja, python3, wrapGAppsHook, wrapQtAppsHook
, qtbase, qtimageformats, gtk3, libsForQt5, lz4, xxHash
, ffmpeg, openalSoft, minizip, libopus, alsa-lib, libpulseaudio, range-v3
, tl-expected, hunspell, glibmm, webkitgtk
# Transitive dependencies:
, pcre, xorg, util-linux, libselinux, libsepol, libepoxy
, at-spi2-core, libXtst, libthai, libdatrie
}:

with lib;

let
  tg_owt = callPackage ./tg_owt.nix {};
in mkDerivation rec {
  pname = "kotatogram-desktop";
  version = "1.4.1";

  src = fetchFromGitHub {
    owner = "kotatogram";
    repo = "kotatogram-desktop";
    rev = "k${version}";
    sha256 = "07z56gz3sk45n5j0gw9p9mxrbwixxsmp7lvqc6lqnxmglz6knc1d";
    fetchSubmodules = true;
  };

  postPatch = ''
    substituteInPlace Telegram/CMakeLists.txt \
      --replace '"''${TDESKTOP_LAUNCHER_BASENAME}.appdata.xml"' '"''${TDESKTOP_LAUNCHER_BASENAME}.metainfo.xml"'
  '';

  # We want to run wrapProgram manually (with additional parameters)
  dontWrapGApps = true;
  dontWrapQtApps = true;

  nativeBuildInputs = [ pkg-config cmake ninja python3 wrapGAppsHook wrapQtAppsHook ];

  buildInputs = [
    qtbase qtimageformats gtk3 libsForQt5.kwayland libsForQt5.libdbusmenu lz4 xxHash
    ffmpeg openalSoft minizip libopus alsa-lib libpulseaudio range-v3
    tl-expected hunspell glibmm webkitgtk
    tg_owt
    # Transitive dependencies:
    pcre xorg.libXdmcp util-linux libselinux libsepol libepoxy
    at-spi2-core libXtst libthai libdatrie
  ];

  cmakeFlags = [ "-DTDESKTOP_API_TEST=ON" ];

  postFixup = ''
    # We also use gappsWrapperArgs from wrapGAppsHook.
    wrapProgram $out/bin/kotatogram-desktop \
      "''${gappsWrapperArgs[@]}" \
      "''${qtWrapperArgs[@]}"
  '';

  passthru = {
    inherit tg_owt;
  };

  meta = {
    description = "Kotatogram – experimental Telegram Desktop fork";
    longDescription = ''
      Unofficial desktop client for the Telegram messenger, based on Telegram Desktop.

      It contains some useful (or purely cosmetic) features, but they could be unstable. A detailed list is available here: https://kotatogram.github.io/changes
    '';
    license = licenses.gpl3;
    platforms = platforms.linux;
    homepage = "https://kotatogram.github.io";
    changelog = "https://github.com/kotatogram/kotatogram-desktop/releases/tag/k{ver}";
    maintainers = with maintainers; [ ilya-fedin ];
  };
}