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