diff --git a/pkgs/development/python-modules/cryptg/default.nix b/pkgs/development/python-modules/cryptg/default.nix new file mode 100644 index 000000000000..2ebc1f0e3626 --- /dev/null +++ b/pkgs/development/python-modules/cryptg/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, rustPlatform +, setuptools-rust +}: + +buildPythonPackage rec { + pname = "cryptg"; + version = "0.3.1"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "cher-nov"; + repo = pname; + rev = "v${version}"; + hash = "sha256-IhzwQrWu8k308ZZhWz4Z3FHAkSLTXiCydyiy0MPN8NI="; + }; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + hash = "sha256-M2ySVqfgpgHktLh4t5Sh1UTBCzajlQiDku4O9azHJwk="; + }; + + nativeBuildInputs = with rustPlatform;[ + setuptools-rust + cargoSetupHook + rust.rustc + rust.cargo + ]; + + # has no tests + doCheck = false; + + pythonImportsCheck = [ "cryptg" ]; + + meta = with lib; { + description = "Official Telethon extension to provide much faster cryptography for Telegram API requests"; + homepage = "https://github.com/cher-nov/cryptg"; + license = licenses.cc0; + maintainers = with maintainers; [ nickcao ]; + }; +} diff --git a/pkgs/development/python-modules/mautrix/default.nix b/pkgs/development/python-modules/mautrix/default.nix index 7b85a17a31a3..a17c2c9c079a 100644 --- a/pkgs/development/python-modules/mautrix/default.nix +++ b/pkgs/development/python-modules/mautrix/default.nix @@ -4,11 +4,11 @@ buildPythonPackage rec { pname = "mautrix"; - version = "0.17.3"; + version = "0.17.8"; src = fetchPypi { inherit pname version; - sha256 = "sha256-j49NrZJMDw8m5ZGP4DXxk7uzF+0BxDjs4coEkMDUP+0="; + sha256 = "sha256-DFajAD5mnXLQmJGRv4j2mWhtIj77nZNSQhbesX4qMys="; }; propagatedBuildInputs = [ diff --git a/pkgs/servers/mautrix-telegram/default.nix b/pkgs/servers/mautrix-telegram/default.nix index eb6372b12037..7e31c22ebd3b 100644 --- a/pkgs/servers/mautrix-telegram/default.nix +++ b/pkgs/servers/mautrix-telegram/default.nix @@ -1,95 +1,73 @@ -{ lib, python3, mautrix-telegram, fetchFromGitHub +{ lib +, python3 +, fetchFromGitHub , withE2BE ? true +, withHQthumbnails ? false }: let python = python3.override { packageOverrides = self: super: { - asyncpg = super.asyncpg.overridePythonAttrs (oldAttrs: rec { - version = "0.25.0"; - src = oldAttrs.src.override { - inherit version; - hash = "sha256-Y/jmppczsoVJfChVRko03mV/LMzSWurutQcYcuk4JUA="; - }; - }); - mautrix = super.mautrix.overridePythonAttrs (oldAttrs: rec { - version = "0.16.3"; - src = oldAttrs.src.override { - inherit (oldAttrs) pname; - inherit version; - sha256 = "sha256-OpHLh5pCzGooQ5yxAa0+85m/szAafV+l+OfipQcfLtU="; - }; - }); tulir-telethon = self.telethon.overridePythonAttrs (oldAttrs: rec { - version = "1.25.0a7"; + version = "1.25.0a20"; pname = "tulir-telethon"; src = oldAttrs.src.override { inherit pname version; - sha256 = "sha256-+wHRrBluM0ejdHjIvSk28wOIfCfIyibBcmwG/ksbiac="; + sha256 = "sha256-X9oo+YCNMqQrJvQa/PIi9dFgaeQxbrlnwUJnwjRb6Jc="; }; }); }; }; - - # officially supported database drivers - dbDrivers = with python.pkgs; [ - psycopg2 - aiosqlite - # sqlite driver is already shipped with python by default - ]; - in python.pkgs.buildPythonPackage rec { pname = "mautrix-telegram"; - version = "0.11.3"; + version = "0.12.0"; disabled = python.pythonOlder "3.8"; src = fetchFromGitHub { owner = "mautrix"; repo = "telegram"; rev = "v${version}"; - sha256 = "sha256-PfER/wqJ607w0xVrFZadzmxYyj72O10c2lIvCW7LT8Y="; + sha256 = "sha256-SUwiRrTY8NgOGQ643prsm3ZklOlwX/59m/u1aewFuik="; }; patches = [ ./0001-Re-add-entrypoint.patch ]; propagatedBuildInputs = with python.pkgs; ([ - Mako - aiohttp - mautrix - sqlalchemy - CommonMark ruamel-yaml python-magic + CommonMark + aiohttp + yarl + mautrix tulir-telethon - telethon-session-sqlalchemy - pillow - lxml - setuptools - prometheus-client - ] ++ lib.optionals withE2BE [ asyncpg + Mako + # optional + cryptg + cchardet + aiodns + brotli + pillow + qrcode + phonenumbers + prometheus-client + aiosqlite + ] ++ lib.optionals withHQthumbnails [ + moviepy + ] ++ lib.optionals withE2BE [ python-olm pycryptodome unpaddedbase64 - ]) ++ dbDrivers; + ]); - # Tests are broken and throw the following for every test: - # TypeError: 'Mock' object is not subscriptable - # - # The tests were touched the last time in 2019 and upstream CI doesn't even build - # those, so it's safe to assume that this part of the software is abandoned. + # has no tests doCheck = false; - checkInputs = with python.pkgs; [ - pytest - pytest-mock - pytest-asyncio - ]; meta = with lib; { homepage = "https://github.com/mautrix/telegram"; description = "A Matrix-Telegram hybrid puppeting/relaybot bridge"; license = licenses.agpl3Plus; platforms = platforms.linux; - maintainers = with maintainers; [ nyanloutre ma27 ]; + maintainers = with maintainers; [ nyanloutre ma27 nickcao ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ec711739e657..c92bf5e2a3a3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2115,6 +2115,8 @@ in { cryptacular = callPackage ../development/python-modules/cryptacular { }; + cryptg = callPackage ../development/python-modules/cryptg { }; + cryptography = callPackage ../development/python-modules/cryptography { inherit (pkgs.darwin) libiconv; inherit (pkgs.darwin.apple_sdk.frameworks) Security;