mail and username config

This commit is contained in:
Noah Masur 2025-02-16 10:48:31 -05:00
parent 617fc6cce2
commit b36895f108
No known key found for this signature in database
5 changed files with 21 additions and 12 deletions

View File

@ -15,13 +15,21 @@ in
enable = lib.mkEnableOption "System outgoing mail"; enable = lib.mkEnableOption "System outgoing mail";
host = lib.mkOption { host = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Hostname for SMTP"; description = "Hostname for SMTP server";
default = config.mail.smtpHost; };
domain = lib.mkOption {
type = lib.types.str;
description = "Domain name for SMTP email";
}; };
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "system@${config.mail.server}"; description = "Username (email address) for SMTP";
default = config.mail.smtpHost; default = "system@${cfg.domain}";
};
passwordFile = lib.mkOption {
type = lib.types.path;
description = "Password file for SMTP";
default = ../../../../../../private/mailpass-system.age;
}; };
}; };
@ -34,7 +42,7 @@ in
default = { default = {
auth = true; auth = true;
host = cfg.host; host = cfg.host;
passwordeval = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}"; passwordeval = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile cfg.passwordFile)}";
user = cfg.user; user = cfg.user;
from_full_name = "${config.networking.hostName} System"; from_full_name = "${config.networking.hostName} System";
port = 465; port = 465;

View File

@ -75,7 +75,7 @@ in
issuers = [ issuers = [
{ {
module = "acme"; module = "acme";
email = "acme@${config.mail.server}"; email = "acme@${config.nmasur.presets.programs.msmtp.domain}";
account_key = "{env.ACME_ACCOUNT_KEY}"; account_key = "{env.ACME_ACCOUNT_KEY}";
challenges = { challenges = {
dns = { dns = {

View File

@ -39,8 +39,8 @@ in
}; };
smtp = rec { smtp = rec {
enabled = true; enabled = true;
host = "${config.mail.smtpHost}:465"; host = "${config.nmasur.presets.programs.msmtp.host}:465";
user = "grafana@${config.mail.server}"; user = "grafana@${config.nmasur.presets.programs.msmtp.domain}";
password = "$__file{${config.secrets.mailpass-grafana.dest}}"; password = "$__file{${config.secrets.mailpass-grafana.dest}}";
from_name = "Grafana"; from_name = "Grafana";
from_address = user; from_address = user;
@ -2415,7 +2415,7 @@ in
{ {
uid = "basic-email"; uid = "basic-email";
type = "email"; type = "email";
settings.addresses = "grafana@${config.mail.server}"; settings.addresses = "grafana@${config.nmasur.presets.programs.msmtp.domain}";
} }
]; ];
} }

View File

@ -40,10 +40,10 @@ in
# Create an email notification service for failed jobs # Create an email notification service for failed jobs
systemd.services."notify-email@" = systemd.services."notify-email@" =
let let
address = "system@${config.mail.server}"; address = "system@${config.nmasur.presets.programs.msmtp.domain}";
in in
{ {
enable = config.mail.enable; enable = config.nmasur.presets.programs.msmtp.enable;
environment.SERVICE_ID = "%i"; environment.SERVICE_ID = "%i";
script = '' script = ''
TEMPFILE=$(mktemp) TEMPFILE=$(mktemp)

View File

@ -6,6 +6,7 @@
}: }:
let let
inherit (config.nmasur.settings) username;
cfg = config.services.betterlockscreen; cfg = config.services.betterlockscreen;
# Disable Dunst so that it's not attempting to reach a non-existent dunst service # Disable Dunst so that it's not attempting to reach a non-existent dunst service
betterlockscreen = pkgs.betterlockscreen.override { withDunst = cfg.dunst.enable; }; betterlockscreen = pkgs.betterlockscreen.override { withDunst = cfg.dunst.enable; };
@ -29,7 +30,7 @@ in
"suspend.target" "suspend.target"
]; ];
serviceConfig = { serviceConfig = {
User = config.user; User = username;
Type = "simple"; Type = "simple";
Environment = "DISPLAY=:0"; Environment = "DISPLAY=:0";
TimeoutSec = "infinity"; TimeoutSec = "infinity";