{ 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"; description = '' E-Mail address automated e-mails are sent from. ''; }; fromIdentity = mkOption { type = types.str; default = "${config.networking.hostName} <${config.email.fromAddress}>"; example = "Maintenance (no reply) "; description = '' E-Mail identity automated e-mails are sent from. ''; }; adminEmail = mkOption { type = types.str; example = "admin@example.com"; description = '' E-Mail address automated e-mails are sent to. ''; }; }; 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; }; }; }; }