2024-07-13 17:34:59 +00:00
|
|
|
# See https://wiki.nixos.org/wiki/Msmtp
|
2024-12-06 16:46:10 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
namespace,
|
|
|
|
...
|
|
|
|
}:
|
2024-02-29 14:53:34 +00:00
|
|
|
|
|
|
|
let
|
2024-12-06 16:46:10 +00:00
|
|
|
cfg = config.${namespace}.services.msmtp;
|
2024-02-29 14:53:34 +00:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 22:02:59 +00:00
|
|
|
options = {
|
2024-12-06 16:46:10 +00:00
|
|
|
${namespace}.services.msmtp = {
|
2024-09-15 18:39:26 +00:00
|
|
|
enable = lib.mkEnableOption "Enables mail server";
|
|
|
|
accounts = lib.mkOption {
|
|
|
|
type = lib.types.attrs;
|
|
|
|
description = "A list of accounts to use for msmtp.";
|
|
|
|
};
|
|
|
|
aliases = lib.mkOption {
|
2024-09-17 14:27:50 +00:00
|
|
|
default = { };
|
2024-09-15 18:39:26 +00:00
|
|
|
type = lib.types.attrs;
|
|
|
|
description = "Optional email aliases to add.";
|
|
|
|
};
|
|
|
|
};
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-08-02 21:55:48 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-05-07 22:02:59 +00:00
|
|
|
programs.msmtp = {
|
|
|
|
enable = true;
|
2024-08-16 19:41:13 +00:00
|
|
|
defaults.aliases = "/etc/aliases";
|
2024-09-15 18:39:26 +00:00
|
|
|
accounts = cfg.accounts;
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
2024-08-16 19:41:13 +00:00
|
|
|
|
|
|
|
# Send all mail to my email address by default
|
2024-09-15 18:39:26 +00:00
|
|
|
environment.etc."aliases" = cfg.aliases;
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
|
|
|
}
|