2022-04-30 20:13:46 +00:00
|
|
|
{ lib, config, pkgs, ... }: {
|
2022-04-30 19:57:51 +00:00
|
|
|
services.mautrix-telegram = {
|
|
|
|
enable = true;
|
|
|
|
environmentFile = config.sops.secrets."services/mautrix/telegram".path;
|
|
|
|
settings = {
|
|
|
|
homeserver = {
|
|
|
|
address = "https://matrix.chir.rs";
|
|
|
|
domain = "chir.rs";
|
|
|
|
http_retry_count = 1000;
|
|
|
|
async_media = true;
|
|
|
|
};
|
|
|
|
appservice = {
|
2022-04-30 20:38:37 +00:00
|
|
|
address = "http://localhost:29317";
|
2022-04-30 19:57:51 +00:00
|
|
|
hostname = "127.0.0.1";
|
|
|
|
port = 29317;
|
|
|
|
max_body_size = 10;
|
|
|
|
database = "postgres:///mautrix_telegram?sslmode=disable&host=/run/postgresql";
|
2022-04-30 21:18:44 +00:00
|
|
|
as_token = "$AS_TOKEN";
|
|
|
|
hs_token = "$HS_TOKEN";
|
2022-04-30 19:57:51 +00:00
|
|
|
};
|
|
|
|
bridge = {
|
|
|
|
displayname_template = "{displayname}";
|
|
|
|
allow_avatar_remove = true;
|
|
|
|
max_initial_member_sync = -1;
|
|
|
|
sync_create_limit = 0;
|
|
|
|
sync_direct_chats = true;
|
|
|
|
sync_direct_chat_list = true;
|
2022-04-30 20:32:50 +00:00
|
|
|
double_puppet_server_map = { };
|
|
|
|
login_shared_secret_map = { };
|
2022-04-30 19:57:51 +00:00
|
|
|
double_puppet_allow_discovery = true;
|
|
|
|
invite_link_resolve = true;
|
2022-04-30 20:03:28 +00:00
|
|
|
animated_sticker.target = "webm";
|
2022-04-30 21:20:56 +00:00
|
|
|
#encryption = {
|
|
|
|
#allow = true;
|
|
|
|
#default = true;
|
|
|
|
#keysharing.allow = true;
|
|
|
|
#};
|
2022-04-30 19:57:51 +00:00
|
|
|
delivery_receipts = true;
|
|
|
|
delivery_error_reports = true;
|
|
|
|
pinned_tag = "m.favourite";
|
|
|
|
archive_tag = "m.lowpriority";
|
|
|
|
permissions = {
|
|
|
|
"@lotte:chir.rs" = "admin";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
telegram = {
|
|
|
|
api_id = "$API_ID";
|
|
|
|
api_hash = "$API_HASH";
|
|
|
|
connection.retries = -1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-04-30 20:05:59 +00:00
|
|
|
sops.secrets."services/mautrix/telegram".owner = "mautrix-telegram";
|
2022-04-30 19:57:51 +00:00
|
|
|
services.postgresql.ensureDatabases = [
|
|
|
|
"mautrix_telegram"
|
|
|
|
];
|
|
|
|
services.postgresql.ensureUsers = [{
|
|
|
|
name = "mautrix-telegram";
|
|
|
|
ensurePermissions = {
|
|
|
|
"DATABASE mautrix_telegram" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}];
|
2022-04-30 20:10:45 +00:00
|
|
|
users.users.mautrix-telegram = {
|
|
|
|
description = "Mautrix telegram bridge";
|
|
|
|
home = "/var/lib/mautrix-telegram";
|
|
|
|
useDefaultShell = true;
|
|
|
|
group = "dendrite";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
systemd.services.mautrix-telegram.serviceConfig = {
|
|
|
|
User = "mautrix-telegram";
|
|
|
|
Group = "dendrite";
|
|
|
|
DynamicUser = lib.mkForce false;
|
|
|
|
};
|
2022-04-30 19:57:51 +00:00
|
|
|
}
|