2020-12-28 18:42:26 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2022-07-20 16:34:14 +02:00
|
|
|
with pkgs;
|
|
|
|
|
|
|
|
# NOTE Reference the environment variable set in the corresponding agenix secret
|
|
|
|
let database.connection_string = "$DB_STRING";
|
|
|
|
|
|
|
|
in {
|
2020-12-28 18:42:26 +01:00
|
|
|
# Matrix server configuration
|
2022-07-20 16:34:14 +02:00
|
|
|
services.dendrite = {
|
2020-12-28 18:42:26 +01:00
|
|
|
enable = true;
|
2022-07-20 16:34:14 +02:00
|
|
|
httpPort = 8008;
|
|
|
|
environmentFile = config.age.secrets.dendrite-postgres.path;
|
|
|
|
loadCredential = [ "private_key:${config.age.secrets.dendrite.path}" ];
|
2022-03-21 16:24:28 +01:00
|
|
|
settings = {
|
2022-07-20 16:34:14 +02:00
|
|
|
global = {
|
|
|
|
server_name = "coolneng.duckdns.org";
|
|
|
|
private_key = config.age.secrets.dendrite.path;
|
|
|
|
inherit database;
|
|
|
|
};
|
|
|
|
# HACK Inherit postgres connection string for the rest of the DBs
|
2022-07-20 19:18:10 +02:00
|
|
|
app_service_api = {
|
|
|
|
inherit database;
|
|
|
|
config_files = [
|
|
|
|
"/var/lib/matrix-as-facebook/facebook-registration.yaml"
|
|
|
|
"/var/lib/matrix-as-signal/signal-registration.yaml"
|
|
|
|
"/var/lib/matrix-as-telegram/telegram-registration.yaml"
|
|
|
|
];
|
|
|
|
};
|
2022-07-20 16:34:14 +02:00
|
|
|
media_api = { inherit database; };
|
|
|
|
room_server = { inherit database; };
|
|
|
|
push_server = { inherit database; };
|
|
|
|
mscs = {
|
|
|
|
inherit database;
|
|
|
|
mscs = [ "msc2836" "msc2946" ];
|
|
|
|
};
|
|
|
|
sync_api = { inherit database; };
|
|
|
|
key_server = { inherit database; };
|
|
|
|
federation_api = { inherit database; };
|
|
|
|
user_api = {
|
|
|
|
account_database = database;
|
|
|
|
device_database = database;
|
|
|
|
};
|
2022-03-21 16:24:28 +01:00
|
|
|
};
|
2020-12-28 18:42:26 +01:00
|
|
|
};
|
|
|
|
|
2022-07-20 16:34:14 +02:00
|
|
|
# Matrix bridges
|
|
|
|
services.matrix-appservices = {
|
|
|
|
homeserver = "dendrite";
|
2022-07-20 19:18:10 +02:00
|
|
|
homeserverDomain = "coolneng.duckdns.org";
|
|
|
|
homeserverURL = "https://matrix.coolneng.duckdns.org";
|
2022-07-20 16:34:14 +02:00
|
|
|
addRegistrationFiles = true;
|
|
|
|
services = {
|
|
|
|
telegram = {
|
2021-02-03 18:38:41 +01:00
|
|
|
port = 8118;
|
2022-07-20 16:34:14 +02:00
|
|
|
format = "mautrix-python";
|
|
|
|
package = mautrix-telegram;
|
2022-07-20 22:38:20 +02:00
|
|
|
serviceConfig.EnvironmentFile = config.age.secrets.telegram.path;
|
2022-07-22 17:14:00 +02:00
|
|
|
settings = {
|
|
|
|
telegram = {
|
|
|
|
api_id = "$API_ID";
|
|
|
|
api_hash = "$API_HASH";
|
|
|
|
};
|
|
|
|
bridge = {
|
|
|
|
permissions."@coolneng:coolneng.duckdns.org" = "admin";
|
|
|
|
backfill.normal_groups = true;
|
|
|
|
};
|
2022-07-20 22:38:20 +02:00
|
|
|
};
|
2022-07-20 16:34:14 +02:00
|
|
|
};
|
|
|
|
facebook = {
|
|
|
|
port = 8228;
|
|
|
|
format = "mautrix-python";
|
|
|
|
package = mautrix-facebook;
|
|
|
|
};
|
|
|
|
signal = {
|
|
|
|
port = 8338;
|
|
|
|
format = "mautrix-python";
|
|
|
|
package = mautrix-signal;
|
|
|
|
serviceConfig = {
|
|
|
|
StateDirectory = [ "matrix-as-signal" "signald" ];
|
|
|
|
JoinNamespaceOf = "signald.service";
|
|
|
|
SupplementaryGroups = [ "signald" ];
|
|
|
|
};
|
|
|
|
settings.signal = {
|
|
|
|
socket_path = config.services.signald.socketPath;
|
|
|
|
outgoing_attachment_dir = "/var/lib/signald/tmp";
|
|
|
|
};
|
2020-12-28 18:42:26 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-07-20 16:34:14 +02:00
|
|
|
|
|
|
|
# Additional settings for mautrix-signal
|
2022-07-20 22:37:52 +02:00
|
|
|
services.signald = {
|
|
|
|
enable = true;
|
|
|
|
user = "matrix-as-signal";
|
|
|
|
};
|
2022-07-20 16:34:14 +02:00
|
|
|
systemd.services.matrix-as-signal = {
|
|
|
|
requires = [ "signald.service" ];
|
|
|
|
after = [ "signald.service" ];
|
2022-08-29 21:41:53 +02:00
|
|
|
path = [ ffmpeg ];
|
2022-07-20 16:34:14 +02:00
|
|
|
};
|
|
|
|
|
2020-12-28 18:42:26 +01:00
|
|
|
}
|