@@ -1,4 +1,4 @@
1−{ lib, python3 }:
1+{ lib, python3, mautrix-telegram }:
22
33with python3.pkgs;
44
@@ -11,11 +11,15 @@ buildPythonPackage rec {
1111 sha256 = "51951845e52c4ca5410e0f4a51d99014dd6df2fcedfca8b7241e045359cbf112";
1212 };
1313
14+ postPatch = ''
15+ sed -i -e '/alembic>/d' setup.py
16+ '';
17+
1418 propagatedBuildInputs = [
19+ Mako
1520 aiohttp
1621 mautrix-appservice
1722 sqlalchemy
18− alembic
1923 CommonMark
2024 ruamel_yaml
2125 future-fstrings
@@ -26,6 +30,18 @@ buildPythonPackage rec {
2630 lxml
2731 ];
2832
33+ # `alembic` (a database migration tool) is only needed for the initial setup,
34+ # and not needed during the actual runtime. However `alembic` requires `mautrix-telegram`
35+ # in its environment to create a database schema from all models.
36+ #
37+ # Hence we need to patch away `alembic` from `mautrix-telegram` and create an `alembic`
38+ # which has `mautrix-telegram` in its environment.
39+ passthru.alembic = alembic.overrideAttrs (old: {
40+ propagatedBuildInputs = old.propagatedBuildInputs ++ [
41+ mautrix-telegram
42+ ];
43+ });
44+
2945 checkInputs = [
3046 pytest
3147 pytestrunner
@@ -37,6 +53,6 @@ buildPythonPackage rec {
3753 homepage = https://github.com/tulir/mautrix-telegram;
3854 description = "A Matrix-Telegram hybrid puppeting/relaybot bridge";
3955 license = licenses.agpl3Plus;
40− maintainers = with maintainers; [ nyanloutre ];
56+ maintainers = with maintainers; [ nyanloutre ma27 ];
4157 };
4258}