zion/modules/communication.nix

92 lines
2.5 KiB
Nix
Raw Normal View History

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}" ];
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;
};
};
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;
};
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" ];
};
2020-12-28 18:42:26 +01:00
}