1{
2 lib,
3 python3,
4 fetchPypi,
5 fetchFromGitHub,
6 withE2BE ? true,
7}:
8
9let
10 python = python3.override {
11 self = python;
12 packageOverrides = self: super: {
13 tulir-telethon = self.telethon.overridePythonAttrs (oldAttrs: rec {
14 version = "1.37.0a1";
15 pname = "tulir-telethon";
16 src = fetchPypi {
17 inherit pname version;
18 hash = "sha256-FckMHqGaBsqvFbrEnDWqJAQG8j/euY2NooesnxV6Kcc=";
19 };
20 doCheck = false;
21 });
22 };
23 };
24in
25python.pkgs.buildPythonPackage rec {
26 pname = "mautrix-telegram";
27 version = "0.15.2";
28 disabled = python.pythonOlder "3.8";
29
30 src = fetchFromGitHub {
31 owner = "mautrix";
32 repo = "telegram";
33 tag = "v${version}";
34 hash = "sha256-uR0vhp7ONyjwMKbgM1iObpFRoQzyQzJLbw4i9P58jTs=";
35 };
36
37 format = "setuptools";
38
39 patches = [ ./0001-Re-add-entrypoint.patch ];
40
41 propagatedBuildInputs =
42 with python.pkgs;
43 (
44 [
45 ruamel-yaml
46 python-magic
47 commonmark
48 aiohttp
49 yarl
50 (mautrix.override { withOlm = withE2BE; })
51 tulir-telethon
52 asyncpg
53 mako
54 setuptools
55 # speedups
56 cryptg
57 aiodns
58 brotli
59 # qr_login
60 pillow
61 qrcode
62 # formattednumbers
63 phonenumbers
64 # metrics
65 prometheus-client
66 # sqlite
67 aiosqlite
68 # proxy support
69 pysocks
70 ]
71 ++ lib.optionals withE2BE [
72 # e2be
73 python-olm
74 pycryptodome
75 unpaddedbase64
76 ]
77 );
78
79 # has no tests
80 doCheck = false;
81
82 meta = with lib; {
83 homepage = "https://github.com/mautrix/telegram";
84 description = "Matrix-Telegram hybrid puppeting/relaybot bridge";
85 license = licenses.agpl3Plus;
86 platforms = platforms.linux;
87 maintainers = with maintainers; [
88 nyanloutre
89 ma27
90 nickcao
91 ];
92 mainProgram = "mautrix-telegram";
93 };
94}