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