home: mail: add msmtp

This commit is contained in:
Bruno BELANYI 2021-05-22 16:09:11 +02:00
parent 0452d696ae
commit b3653a63bd
3 changed files with 30 additions and 1 deletions

View file

@ -1,5 +1,7 @@
{ lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.home.mail;
mkAddress = address: domain: "${address}@${domain}"; mkAddress = address: domain: "${address}@${domain}";
mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: { mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: {
@ -12,6 +14,10 @@ let
aliases = builtins.map (lib.flip mkAddress domain) aliases; aliases = builtins.map (lib.flip mkAddress domain) aliases;
inherit primary; inherit primary;
msmtp = {
enable = cfg.msmtp.enable;
};
}; };
migaduConfig = { migaduConfig = {

View file

@ -1,9 +1,23 @@
{ config, lib, ... }: { config, lib, ... }:
let
cfg = config.my.home.mail;
mkRelatedOption = desc: lib.mkEnableOption desc // { default = cfg.enable; };
in
{ {
imports = [ imports = [
./accounts.nix ./accounts.nix
./msmtp.nix
]; ];
options.my.home.mail = with lib; {
enable = my.mkDisableOption "email configuration";
msmtp = {
enable = mkRelatedOption "msmtp configuration";
};
};
config = { config = {
accounts.email = { accounts.email = {
maildirBasePath = "mail"; maildirBasePath = "mail";

9
home/mail/msmtp.nix Normal file
View 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;
};
}