1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 # deps
7 setuptools,
8 aiohttp,
9 attrs,
10 yarl,
11 # optional deps
12 python-magic,
13 python-olm,
14 unpaddedbase64,
15 pycryptodome,
16 # check deps
17 pytestCheckHook,
18 pytest-asyncio,
19 aiosqlite,
20 asyncpg,
21 ruamel-yaml,
22
23 withOlm ? false,
24}:
25
26buildPythonPackage rec {
27 pname = "mautrix";
28 version = "0.20.7";
29 pyproject = true;
30
31 disabled = pythonOlder "3.10";
32
33 src = fetchFromGitHub {
34 owner = "mautrix";
35 repo = "python";
36 tag = "v${version}";
37 hash = "sha256-tOX/KQrECeEV3/0q3tpO4brUdalmw6IincF6pHzsEE8=";
38 };
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 aiohttp
44 attrs
45 yarl
46 ] ++ lib.optionals withOlm optional-dependencies.encryption;
47
48 optional-dependencies = {
49 detect_mimetype = [ python-magic ];
50 encryption = [
51 python-olm
52 unpaddedbase64
53 pycryptodome
54 ];
55 };
56
57 nativeCheckInputs = [
58 pytestCheckHook
59 pytest-asyncio
60 aiosqlite
61 asyncpg
62 ruamel-yaml
63 ];
64
65 disabledTestPaths = lib.optionals (!withOlm) [ "mautrix/crypto/" ];
66
67 pythonImportsCheck = [ "mautrix" ];
68
69 meta = with lib; {
70 description = "Asyncio Matrix framework";
71 homepage = "https://github.com/tulir/mautrix-python";
72 changelog = "https://github.com/mautrix/python/releases/tag/v${version}";
73 license = licenses.mpl20;
74 maintainers = with maintainers; [
75 nyanloutre
76 ma27
77 sumnerevans
78 nickcao
79 ];
80 };
81}