home: mail: add msmtp

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

View file

@ -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 = {

View file

@ -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
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;
};
}