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