Merge pull request #243047 from chayleaf/maubot

maubot: init at 0.4.1

authored by

asymmetric and committed by
GitHub
1697b7d4 eb23738e

+154
+13
pkgs/tools/networking/maubot/allow-building-plugins-from-nix-store.patch
··· 1 + diff --git a/maubot/cli/commands/build.py b/maubot/cli/commands/build.py 2 + index ec3ac26..4de85f2 100644 3 + --- a/maubot/cli/commands/build.py 4 + +++ b/maubot/cli/commands/build.py 5 + @@ -84,7 +84,7 @@ def read_output_path(output: str, meta: PluginMeta) -> str | None: 6 + 7 + 8 + def write_plugin(meta: PluginMeta, output: str | IO) -> None: 9 + - with zipfile.ZipFile(output, "w") as zip: 10 + + with zipfile.ZipFile(output, "w", strict_timestamps=False) as zip: 11 + meta_dump = BytesIO() 12 + yaml.dump(meta.serialize(), meta_dump) 13 + zip.writestr("maubot.yaml", meta_dump.getvalue())
+137
pkgs/tools/networking/maubot/default.nix
··· 1 + { lib 2 + , fetchPypi 3 + , fetchpatch 4 + , runCommand 5 + , python3 6 + , encryptionSupport ? true 7 + }: 8 + 9 + let 10 + python = python3.override { 11 + packageOverrides = final: prev: { 12 + # aiosqlite>=0.16,<0.19 13 + aiosqlite = prev.aiosqlite.overridePythonAttrs (old: rec { 14 + version = "0.18.0"; 15 + src = old.src.override { 16 + rev = "refs/tags/v${version}"; 17 + hash = "sha256-yPGSKqjOz1EY5/V0oKz2EiZ90q2O4TINoXdxHuB7Gqk="; 18 + }; 19 + }); 20 + # mautrix>=0.19.8,<0.20 21 + mautrix = prev.mautrix.overridePythonAttrs (old: rec { 22 + version = "0.19.16"; 23 + disabled = final.pythonOlder "3.8"; 24 + checkInputs = old.checkInputs ++ [ final.sqlalchemy ]; 25 + SQLALCHEMY_SILENCE_UBER_WARNING = true; 26 + src = old.src.override { 27 + rev = "refs/tags/v${version}"; 28 + hash = "sha256-aZlc4+J5Q+N9qEzGUMhsYguPdUy+E5I06wrjVyqvVDk="; 29 + }; 30 + }); 31 + # mautrix has a runtime error with new ruamel-yaml since 0.17.22 changed the interface 32 + ruamel-yaml = prev.ruamel-yaml.overridePythonAttrs (prev: rec { 33 + version = "0.17.21"; 34 + src = prev.src.override { 35 + version = version; 36 + hash = "sha256-i3zml6LyEnUqNcGsQURx3BbEJMlXO+SSa1b/P10jt68="; 37 + }; 38 + }); 39 + # SQLAlchemy>=1,<1.4 40 + # SQLAlchemy 2.0's derivation is very different, so don't override, just write it from scratch 41 + # (see https://github.com/NixOS/nixpkgs/blob/65dbed73949e4c0207e75dcc7271b29f9e457670/pkgs/development/python-modules/sqlalchemy/default.nix) 42 + sqlalchemy = final.buildPythonPackage rec { 43 + pname = "SQLAlchemy"; 44 + version = "1.3.24"; 45 + 46 + src = fetchPypi { 47 + inherit pname version; 48 + sha256 = "sha256-67t3fL+TEjWbiXv4G6ANrg9ctp+6KhgmXcwYpvXvdRk="; 49 + }; 50 + 51 + postInstall = '' 52 + sed -e 's:--max-worker-restart=5::g' -i setup.cfg 53 + ''; 54 + 55 + # tests are pretty annoying to set up for this version, and these dependency overrides are already long enough 56 + doCheck = false; 57 + }; 58 + }; 59 + }; 60 + 61 + maubot = python.pkgs.buildPythonPackage rec { 62 + pname = "maubot"; 63 + version = "0.4.1"; 64 + disabled = python.pythonOlder "3.8"; 65 + 66 + src = fetchPypi { 67 + inherit pname version; 68 + sha256 = "sha256-Ro2PPgF8818F8JewPZ3AlbfWFNNHKTZkQq+1zpm3kk4="; 69 + }; 70 + 71 + patches = [ 72 + # add entry point - https://github.com/maubot/maubot/pull/146 73 + (fetchpatch { 74 + url = "https://github.com/maubot/maubot/commit/283f0a3ed5dfae13062b6f0fd153fbdc477f4381.patch"; 75 + sha256 = "0yn5357z346qzy5v5g124mgiah1xsi9yyfq42zg028c8paiw8s8x"; 76 + }) 77 + # allow running "mbc build" in a nix derivation 78 + ./allow-building-plugins-from-nix-store.patch 79 + ]; 80 + 81 + propagatedBuildInputs = with python.pkgs; [ 82 + # requirements.txt 83 + mautrix 84 + aiohttp 85 + yarl 86 + sqlalchemy 87 + asyncpg 88 + aiosqlite 89 + commonmark 90 + ruamel-yaml 91 + attrs 92 + bcrypt 93 + packaging 94 + click 95 + colorama 96 + questionary 97 + jinja2 98 + ] 99 + # optional-requirements.txt 100 + ++ lib.optionals encryptionSupport [ 101 + python-olm 102 + pycryptodome 103 + unpaddedbase64 104 + ]; 105 + 106 + postInstall = '' 107 + rm $out/example-config.yaml 108 + ''; 109 + 110 + passthru.tests = { 111 + simple = runCommand "${pname}-tests" { } '' 112 + ${maubot}/bin/mbc --help > $out 113 + ''; 114 + }; 115 + 116 + # Setuptools is trying to do python -m maubot test 117 + dontUseSetuptoolsCheck = true; 118 + 119 + pythonImportsCheck = [ 120 + "maubot" 121 + ]; 122 + 123 + meta = with lib; { 124 + description = "A plugin-based Matrix bot system written in Python"; 125 + homepage = "https://maubot.xyz/"; 126 + changelog = "https://github.com/maubot/maubot/blob/v${version}/CHANGELOG.md"; 127 + license = licenses.agpl3Plus; 128 + # Presumably, people running "nix run nixpkgs#maubot" will want to run the tool 129 + # for interacting with Maubot rather than Maubot itself, which should be used as 130 + # a NixOS module. 131 + mainProgram = "mbc"; 132 + maintainers = with maintainers; [ chayleaf ]; 133 + }; 134 + }; 135 + 136 + in 137 + maubot
+2
pkgs/top-level/all-packages.nix
··· 10029 10029 10030 10030 matrix-hookshot = callPackage ../servers/matrix-synapse/matrix-hookshot { }; 10031 10031 10032 + maubot = with python3Packages; toPythonApplication maubot; 10033 + 10032 10034 mautrix-discord = callPackage ../servers/mautrix-discord { }; 10033 10035 10034 10036 mautrix-facebook = callPackage ../servers/mautrix-facebook { };
+2
pkgs/top-level/python-packages.nix
··· 6485 6485 6486 6486 mattermostdriver = callPackage ../development/python-modules/mattermostdriver { }; 6487 6487 6488 + maubot = callPackage ../tools/networking/maubot { }; 6489 + 6488 6490 mautrix = callPackage ../development/python-modules/mautrix { }; 6489 6491 6490 6492 mautrix-appservice = self.mautrix; # alias 2019-12-28