Enable e-mail services for auto-upgrade

This commit is contained in:
fruchti 2023-03-07 19:35:34 +01:00
parent 1260f41dbb
commit 99ed3884f8
3 changed files with 87 additions and 79 deletions

View file

@ -1,7 +1,11 @@
{ config, lib, ... }:
with lib;
let
cfg = config.email;
in
{
options.email = {
enable = lib.mkEnableOption "Allow sending system status e-mails via sendmail";
fromAddress = mkOption {
type = types.str;
example = "noreply@example.com";
@ -25,4 +29,21 @@ with lib;
'';
};
};
config.programs.msmtp = lib.mkIf cfg.enable {
enable = true;
setSendmail = true;
accounts = {
default = {
auth = true;
host = "gvfr.de";
passwordeval = "cat /secrets/email_password.txt";
user = cfg.fromAddress;
from = cfg.fromAddress;
port = 465;
tls = true;
tls_starttls = false;
};
};
};
}