mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-12 17:02:02 +00:00
mail stuff
This commit is contained in:
parent
1e5fd5d9ae
commit
9c5de4c54f
@ -1,39 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.msmtp-system;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.msmtp-system.enable = lib.mkEnableOption "System outgoing mail";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.msmtp.enable = true;
|
||||
|
||||
# The system user for sending automatic notifications
|
||||
accounts.email.accounts.system =
|
||||
let
|
||||
address = "system@${config.mail.server}";
|
||||
in
|
||||
{
|
||||
userName = address;
|
||||
realName = "NixOS System";
|
||||
primary = !config.mail.enable; # Only primary if mail not enabled
|
||||
inherit address;
|
||||
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
||||
msmtp.enable = true;
|
||||
smtp = {
|
||||
host = config.mail.smtpHost;
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
47
platforms/nixos/modules/nmasur/presets/programs/msmtp.nix
Normal file
47
platforms/nixos/modules/nmasur/presets/programs/msmtp.nix
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.msmtp;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.msmtp = {
|
||||
enable = lib.mkEnableOption "System outgoing mail";
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Hostname for SMTP";
|
||||
default = config.mail.smtpHost;
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "system@${config.mail.server}";
|
||||
default = config.mail.smtpHost;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.msmtp = {
|
||||
enable = true;
|
||||
setSendmail = true;
|
||||
accounts = {
|
||||
# The system user for sending automatic notifications
|
||||
default = {
|
||||
auth = true;
|
||||
host = cfg.host;
|
||||
passwordeval = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
||||
user = cfg.user;
|
||||
from_full_name = "${config.networking.hostName} System";
|
||||
port = 465;
|
||||
tls = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -24,7 +24,7 @@ in
|
||||
default = "/var/private";
|
||||
};
|
||||
|
||||
secretsIdentityFile = lib.mkOption {
|
||||
identityFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Path containing decryption identity.";
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user