modules: services: matrix: add mail configuration
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bruno BELANYI 2021-06-09 18:54:16 +02:00
parent 6614b47546
commit ee21de5b94
2 changed files with 45 additions and 0 deletions

View file

@ -65,6 +65,7 @@ in
# Matrix backend and Element chat front-end # Matrix backend and Element chat front-end
matrix = { matrix = {
enable = true; enable = true;
mail = my.secrets.matrix.mail;
secret = my.secrets.matrix.secret; secret = my.secrets.matrix.secret;
}; };
miniflux = { miniflux = {

View file

@ -18,11 +18,46 @@ in
{ {
options.my.services.matrix = with lib; { options.my.services.matrix = with lib; {
enable = mkEnableOption "Matrix Synapse"; enable = mkEnableOption "Matrix Synapse";
secret = mkOption { secret = mkOption {
type = types.str; type = types.str;
example = "deadbeef"; example = "deadbeef";
description = "Shared secret to register users"; description = "Shared secret to register users";
}; };
mail = {
host = mkOption {
type = types.str;
default = "smtp.migadu.com";
example = "smtp.example.com";
description = "Which host should be used for SMTP";
};
port = mkOption {
type = types.port;
default = 587;
example = 25;
description = "Which port should be used for SMTP";
};
username = mkOption {
type = types.str;
example = "matrix@example.com";
description = "Which username should be used to connect";
};
password = mkOption {
type = types.str;
example = "password";
description = "Which password should be used to connect";
};
notifFrom = mkOption {
type = types.str;
example = "<matrix@example.com>";
description = "Which address should be used for `From` field";
};
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -72,6 +107,15 @@ in
extraConfig = '' extraConfig = ''
experimental_features: experimental_features:
spaces_enabled: true spaces_enabled: true
email:
smtp_host: "${cfg.mail.host}"
smtp_port: ${toString cfg.mail.port}
smtp_user: "${cfg.mail.username}"
smtp_pass: "${cfg.mail.password}"
notif_from: "${cfg.mail.notifFrom}"
# Refuse to connect unless the server supports STARTTLS.
require_transport_security: true
''; '';
}; };