2024-06-26 05:11:44 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
2022-07-22 10:54:03 +00:00
|
|
|
imports = [
|
|
|
|
../../modules/matrix/mautrix-discord.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
services.mautrix-discord = {
|
|
|
|
enable = true;
|
2024-06-26 05:11:44 +00:00
|
|
|
environmentFile = config.sops.secrets."services/mautrix/shared_secret".path;
|
2022-07-22 10:54:03 +00:00
|
|
|
settings = {
|
|
|
|
homeserver = {
|
2023-04-18 18:28:10 +00:00
|
|
|
address = "https://matrix.chir.rs";
|
2022-07-22 10:54:03 +00:00
|
|
|
domain = "chir.rs";
|
2023-09-08 11:41:22 +00:00
|
|
|
async_media = true;
|
2022-07-22 10:54:03 +00:00
|
|
|
};
|
|
|
|
appservice = {
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
uri = "postgres:///mautrix_discord?sslmode=disable&host=/run/postgresql";
|
|
|
|
};
|
2023-10-01 14:47:26 +00:00
|
|
|
ephemeral_events = true;
|
2023-04-19 20:09:26 +00:00
|
|
|
async_transactions = true;
|
2022-07-22 10:54:03 +00:00
|
|
|
};
|
|
|
|
metrics = {
|
|
|
|
enabled = true;
|
2022-07-22 16:30:08 +00:00
|
|
|
listen = "[::]:29321";
|
2022-07-22 10:54:03 +00:00
|
|
|
};
|
|
|
|
bridge = {
|
2023-05-28 12:31:17 +00:00
|
|
|
channel_name_template = "{{if or (eq .Type 3) (eq .Type 4)}}{{.Name}} ({{.GuildName}} — {{.ParentName}}){{else}}#{{.Name}} ({{.GuildName}} — {{.ParentName}}){{end}}";
|
|
|
|
private_chat_portal_meta = "always";
|
2023-04-19 20:09:26 +00:00
|
|
|
startup_private_channel_create_limit = 25;
|
2022-07-22 10:54:03 +00:00
|
|
|
delivery_receipts = true;
|
2022-11-24 09:21:48 +00:00
|
|
|
sync_direct_chat_list = true;
|
2023-05-28 19:27:47 +00:00
|
|
|
delete_portal_on_channel_delete = true;
|
2023-05-28 12:31:17 +00:00
|
|
|
prefix_webhook_messages = true;
|
|
|
|
cache_media = "always";
|
2023-06-08 07:00:58 +00:00
|
|
|
animated_sticker.target = "disable";
|
2023-04-19 20:09:26 +00:00
|
|
|
backfill = {
|
2023-04-21 06:19:40 +00:00
|
|
|
forward_limits = {
|
|
|
|
initial.dm = 50;
|
|
|
|
initial.channel = 50;
|
2023-10-01 14:47:26 +00:00
|
|
|
initial.thread = 50;
|
2023-04-19 20:09:26 +00:00
|
|
|
|
2023-04-21 06:19:40 +00:00
|
|
|
missed.dm = -1;
|
|
|
|
missed.channel = -1;
|
2023-10-01 14:47:26 +00:00
|
|
|
missed.thread = -1;
|
2023-04-21 06:19:40 +00:00
|
|
|
};
|
2023-04-19 20:09:26 +00:00
|
|
|
};
|
2023-05-28 12:31:17 +00:00
|
|
|
encryption = {
|
2023-05-28 19:27:47 +00:00
|
|
|
allow = true;
|
2024-10-27 05:50:41 +00:00
|
|
|
default = false;
|
2024-09-09 19:14:01 +00:00
|
|
|
appservice = true;
|
2024-03-13 19:47:47 +00:00
|
|
|
require = false;
|
2023-10-01 14:47:26 +00:00
|
|
|
plaintext_mentions = true;
|
2023-05-28 19:27:47 +00:00
|
|
|
allow_key_sharing = true;
|
2023-05-28 12:31:17 +00:00
|
|
|
};
|
|
|
|
permissions = {
|
|
|
|
"*" = "relay";
|
2024-05-17 07:05:12 +00:00
|
|
|
"@miifox:chir.rs" = "user";
|
2023-05-28 12:31:17 +00:00
|
|
|
"@lotte:chir.rs" = "admin";
|
|
|
|
};
|
2024-06-26 05:11:44 +00:00
|
|
|
login_shared_secret_map = {
|
|
|
|
"chir.rs" = "as_token:$SHARED_AS_TOKEN";
|
|
|
|
};
|
2022-07-22 10:54:03 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-26 05:11:44 +00:00
|
|
|
sops.secrets."services/mautrix/shared_secret" = {};
|
2022-07-22 10:54:03 +00:00
|
|
|
services.postgresql.ensureDatabases = [
|
|
|
|
"mautrix_discord"
|
|
|
|
];
|
|
|
|
}
|