telegram bridge matrix

This commit is contained in:
Giulio De Pasquale 2021-08-31 16:36:42 +02:00
parent a1b24c1db6
commit 8256e7920a

View File

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ pkgs, config, tmp, ... }:
with import ./network.nix;
{
@ -11,7 +11,10 @@ with import ./network.nix;
registration_shared_secret = "runas!";
dynamic_thumbnails = true;
enable_registration = true;
app_service_config_files = [ "/var/lib/matrix-synapse/discord-registration.yaml" ];
app_service_config_files = [
"/var/lib/matrix-synapse/discord-registration.yaml"
"/var/lib/matrix-synapse/telegram-registration.yaml"
];
extraConfig = ''
auto_join_rooms:
- "#infra:matrix.giugl.io"
@ -79,7 +82,7 @@ with import ./network.nix;
enableACME = true;
forceSSL = true;
root = pkgs.element-web.override {
root = pkgs.unstable.element-web.override {
conf = {
default_server_config."m.homeserver" = {
"base_url" = "https://${matrixdomain}";
@ -90,6 +93,7 @@ with import ./network.nix;
};
};
# discord bridge
matrix-appservice-discord = {
enable = true;
environmentFile = /secrets/matrix-appservice-discord/tokens.env;
@ -103,8 +107,56 @@ with import ./network.nix;
};
};
};
# telegram bridge
mautrix-telegram = {
enable = true;
environmentFile = /secrets/mautrix-telegram/mautrix-telegram.env;
settings = {
homeserver = {
address = "https://${matrixdomain}";
domain = "${matrixdomain}";
};
appservice = {
provisioning.enabled = false;
id = "telegram";
};
bridge = {
permissions = {
"@pepe:${matrixdomain}" = "admin";
"${matrixdomain}" = "puppeting";
};
# 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!)
];
networking.extraHosts = ''
127.0.0.1 ${matrixdomain} ${matrixwebdomain}
${architect-lan} ${matrixdomain} ${matrixwebdomain}