From 7e558d0d52b4201b2e0b7de2eb1a2d75fab02a2e Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 25 Oct 2021 10:01:56 -0600 Subject: [PATCH] matrix-synapse: email config for nevarro --- host-configurations/nevarro.nix | 22 +++++++++++++++--- modules/services/matrix/synapse/default.nix | 6 +++++ .../services/matrix/synapse/shared-config.nix | 5 ++-- secrets/matrix/nevarro-smtp-pass | Bin 0 -> 87 bytes 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 secrets/matrix/nevarro-smtp-pass diff --git a/host-configurations/nevarro.nix b/host-configurations/nevarro.nix index 439bb63..f47f3af 100644 --- a/host-configurations/nevarro.nix +++ b/host-configurations/nevarro.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: { +{ config, lib, ... }: with lib; { hardware.isServer = true; # Set the hostname @@ -70,7 +70,23 @@ services.standupbot.passwordFile = "/etc/nixos/secrets/matrix/bots/standupbot"; # Synapse - services.matrix-synapse-custom.enable = true; - services.matrix-synapse-custom.registrationSharedSecretFile = ../secrets/matrix/registration-shared-secret/nevarro; + services.matrix-synapse-custom = { + enable = true; + registrationSharedSecretFile = ../secrets/matrix/registration-shared-secret/nevarro; + emailCfg = { + smtp_host = "smtp.migadu.com"; + smtp_port = 587; + require_transport_security = true; + + smtp_user = "matrix@nevarro.space"; + smtp_pass = removeSuffix "\n" (readFile ../secrets/matrix/nevarro-smtp-pass); + + notif_from = "Nevarro %(app)s Admin "; + app_name = "Matrix"; + enable_notifs = true; + notif_for_new_users = false; + invite_client_location = "https://app.element.io"; + }; + }; services.cleanup-synapse.environmentFile = "/etc/nixos/secrets/matrix/cleanup-synapse/bespin"; } diff --git a/modules/services/matrix/synapse/default.nix b/modules/services/matrix/synapse/default.nix index d55d62a..5d7db5a 100644 --- a/modules/services/matrix/synapse/default.nix +++ b/modules/services/matrix/synapse/default.nix @@ -171,6 +171,12 @@ in The path to a file that contains the shared registration secret. ''; }; + + emailCfg = mkOption { + type = with types; attrsOf anything; + default = { }; + description = "The email configuration."; + }; }; }; diff --git a/modules/services/matrix/synapse/shared-config.nix b/modules/services/matrix/synapse/shared-config.nix index 6705260..d42b206 100644 --- a/modules/services/matrix/synapse/shared-config.nix +++ b/modules/services/matrix/synapse/shared-config.nix @@ -21,13 +21,13 @@ let root = { level = "INFO"; handlers = [ "journal" ]; }; disable_existing_loggers = false; }; - in { # Server server_name = config.networking.domain; pid_file = "/run/matrix-synapse.pid"; default_room_version = "9"; + public_baseurl = "https://matrix.${config.networking.domain}"; listeners = [ # CS API and Federation { @@ -124,7 +124,8 @@ in ]; suppress_key_server_warning = true; - # TODO email? + # Email + email = cfg.emailCfg; # Workers send_federation = false; diff --git a/secrets/matrix/nevarro-smtp-pass b/secrets/matrix/nevarro-smtp-pass new file mode 100644 index 0000000000000000000000000000000000000000..369596ad70530c0db62f950529d904d36c052400 GIT binary patch literal 87 zcmV-d0I2@}M@dveQdv+`0C$OsKF0cQo2BJqw`nr<@2Gy9>xwdP4bT5A$sh}!o^9G3 tu&wbT;Y(a=&Vv5B23FyO&5@kGLD~A6<6eFzRCpTBO`Wz70%x99(K20kE8747 literal 0 HcmV?d00001 -- 2.38.5