diff options
author | sils <sils@sils.li> | 2023-07-24 12:52:57 +0200 |
---|---|---|
committer | sils <sils@sils.li> | 2023-07-24 12:52:57 +0200 |
commit | 98b152e9c15b56795419abde6e7b1f30def3d3d7 (patch) | |
tree | 185aa36d311d86dbcc11b9ac40b842d3609103c2 /system/services/matrix/bridges | |
parent | chore(version): v0.4.0 (diff) | |
download | nixos-server-mautrix-telegram.tar.gz nixos-server-mautrix-telegram.zip |
Feat(system): Add initial mautrix-telegram config mautrix-telegram
This won't work and isn't supposed to, in fact this commit is designed to be squashed or rebased. The config in system/services/matrix/bridges/mautrix-telegram/default.nix is mainly copy-pasted from nixos-wiki.
Diffstat (limited to 'system/services/matrix/bridges')
-rw-r--r-- | system/services/matrix/bridges/mautrix-telegram/default.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/system/services/matrix/bridges/mautrix-telegram/default.nix b/system/services/matrix/bridges/mautrix-telegram/default.nix new file mode 100644 index 0000000..ec54321 --- /dev/null +++ b/system/services/matrix/bridges/mautrix-telegram/default.nix @@ -0,0 +1,67 @@ +{config, ...}: { + services.matrix-synapse.settings.app_service_config_files = [ + # The registration file is automatically generated after starting the + # appservice for the first time. + # cp /var/lib/mautrix-telegram/telegram-registration.yaml \ + # /var/lib/matrix-synapse/ + # chown matrix-synapse:matrix-synapse \ + # /var/lib/matrix-synapse/telegram-registration.yaml + "/var/lib/matrix-synapse/telegram-registration.yaml" + ]; + + services.mautrix-telegram = { + enable = true; + + # file containing the appservice and telegram tokens + environmentFile = "${config.age.secrets.mautrix-telegram_environment_file.path}"; + + # The appservice is pre-configured to use SQLite by default. + # It's also possible to use PostgreSQL. + settings = { + homeserver = { + address = "http://localhost:8008"; + domain = "domain.tld"; + }; + appservice = { + provisioning.enabled = false; + id = "telegram"; + public = { + enabled = true; + prefix = "/public"; + external = "http://domain.tld:8080/public"; + }; + + # The service uses SQLite by default, but it's also possible to use + # PostgreSQL instead: + #database = "postgresql:///mautrix-telegram?host=/run/postgresql"; + }; + bridge = { + relaybot.authless_portals = false; + permissions = { + "@someadmin:domain.tld" = "admin"; + }; + + # Animated stickers conversion requires additional packages in the + # service's path. + # If this isn't a fresh installation, clearing the bridge's uploaded + # file cache might be necessary (make a database backup first!): + # delete from telegram_file where \ + # mime_type in ('application/gzip', 'application/octet-stream') + animated_sticker = { + target = "gif"; + args = { + width = 256; + height = 256; + fps = 30; # only for webm + background = "020202"; # only for gif, transparency not supported + }; + }; + }; + }; + }; + + systemd.services.mautrix-telegram.path = with pkgs; [ + lottieconverter # for animated stickers conversion, unfree package + ffmpeg # if converting animated stickers to webm (very slow!) + ]; +} |