home: mail: add msmtp
This commit is contained in:
parent
182ec2a4db
commit
d31e293cef
|
@ -1,5 +1,7 @@
|
|||
{ lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.home.mail;
|
||||
|
||||
mkAddress = address: domain: "${address}@${domain}";
|
||||
|
||||
mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: {
|
||||
|
@ -12,6 +14,10 @@ let
|
|||
aliases = builtins.map (lib.flip mkAddress domain) aliases;
|
||||
|
||||
inherit primary;
|
||||
|
||||
msmtp = {
|
||||
enable = cfg.msmtp.enable;
|
||||
};
|
||||
};
|
||||
|
||||
migaduConfig = {
|
||||
|
|
|
@ -1,9 +1,23 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.mail;
|
||||
|
||||
mkRelatedOption = desc: lib.mkEnableOption desc // { default = cfg.enable; };
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./accounts.nix
|
||||
./msmtp.nix
|
||||
];
|
||||
|
||||
options.my.home.mail = with lib; {
|
||||
enable = my.mkDisableOption "email configuration";
|
||||
|
||||
msmtp = {
|
||||
enable = mkRelatedOption "msmtp configuration";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
accounts.email = {
|
||||
maildirBasePath = "mail";
|
||||
|
|
9
home/mail/msmtp.nix
Normal file
9
home/mail/msmtp.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.home.mail.msmtp;
|
||||
in
|
||||
{
|
||||
config.programs.msmtp = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue