Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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.8";
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-giK8JZ6nzsA8SV6CzDNEbJmbwDju9t6fLJr/oXNjvKs=";
38 };
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 aiohttp
44 attrs
45 yarl
46 ]
47 ++ lib.optionals withOlm optional-dependencies.encryption;
48
49 optional-dependencies = {
50 detect_mimetype = [ python-magic ];
51 encryption = [
52 python-olm
53 unpaddedbase64
54 pycryptodome
55 ];
56 };
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 pytest-asyncio
61 aiosqlite
62 asyncpg
63 ruamel-yaml
64 ];
65
66 disabledTestPaths = lib.optionals (!withOlm) [ "mautrix/crypto/" ];
67
68 pythonImportsCheck = [ "mautrix" ];
69
70 meta = with lib; {
71 description = "Asyncio Matrix framework";
72 homepage = "https://github.com/tulir/mautrix-python";
73 changelog = "https://github.com/mautrix/python/releases/tag/v${version}";
74 license = licenses.mpl20;
75 maintainers = with maintainers; [
76 nyanloutre
77 ma27
78 sumnerevans
79 nickcao
80 ];
81 };
82}