2021-05-22 16:09:11 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-05-22 16:04:46 +02:00
|
|
|
let
|
2021-05-22 16:09:11 +02:00
|
|
|
cfg = config.my.home.mail;
|
|
|
|
|
2021-10-12 17:54:54 +02:00
|
|
|
inherit (lib.my) mkMailAddress;
|
2021-05-22 16:04:46 +02:00
|
|
|
|
|
|
|
mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: {
|
|
|
|
realName = lib.mkDefault "Bruno BELANYI";
|
2021-10-12 17:54:54 +02:00
|
|
|
userName = lib.mkDefault (mkMailAddress address domain);
|
2021-05-22 16:04:46 +02:00
|
|
|
passwordCommand =
|
|
|
|
lib.mkDefault [ "${pkgs.ambroisie.bw-pass}/bin/bw-pass" "Mail" passName ];
|
|
|
|
|
2021-10-12 17:54:54 +02:00
|
|
|
address = mkMailAddress address domain;
|
|
|
|
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;
|
2021-05-22 16:04:46 +02:00
|
|
|
|
|
|
|
inherit primary;
|
2021-05-22 16:09:11 +02:00
|
|
|
|
2021-06-22 17:59:47 +02:00
|
|
|
himalaya = {
|
|
|
|
enable = cfg.himalaya.enable;
|
|
|
|
};
|
|
|
|
|
2021-05-22 16:09:11 +02:00
|
|
|
msmtp = {
|
|
|
|
enable = cfg.msmtp.enable;
|
|
|
|
};
|
2021-05-22 16:04:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
migaduConfig = {
|
|
|
|
imap = {
|
|
|
|
host = "imap.migadu.com";
|
|
|
|
port = 993;
|
|
|
|
tls = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
host = "smtp.migadu.com";
|
|
|
|
port = 465;
|
|
|
|
tls = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
gmailConfig = {
|
|
|
|
flavor = "gmail.com";
|
|
|
|
folders = {
|
|
|
|
drafts = "[Gmail]/Drafts";
|
|
|
|
sent = "[Gmail]/Sent Mail";
|
|
|
|
trash = "[Gmail]/Trash";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
office365Config = {
|
|
|
|
imap = {
|
|
|
|
host = "outlook.office365.com";
|
|
|
|
port = 993;
|
|
|
|
tls = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
host = "outlook.office365.com";
|
|
|
|
port = 587;
|
|
|
|
tls = {
|
|
|
|
enable = true;
|
|
|
|
useStartTls = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config.accounts.email.accounts = {
|
|
|
|
personal = lib.mkMerge [
|
|
|
|
# Common configuraton
|
|
|
|
(mkConfig {
|
|
|
|
domain = "belanyi.fr";
|
|
|
|
address = "bruno";
|
|
|
|
passName = "Migadu";
|
|
|
|
aliases = [ "admin" "postmaster" ];
|
|
|
|
primary = true; # This is my primary email
|
|
|
|
})
|
|
|
|
migaduConfig
|
|
|
|
];
|
|
|
|
|
|
|
|
gmail = lib.mkMerge [
|
|
|
|
# Common configuraton
|
|
|
|
(mkConfig {
|
|
|
|
domain = "gmail.com";
|
|
|
|
address = "brunobelanyi";
|
|
|
|
passName = "GMail";
|
|
|
|
})
|
|
|
|
gmailConfig
|
|
|
|
];
|
|
|
|
|
|
|
|
epita = lib.mkMerge [
|
|
|
|
# Common configuration
|
|
|
|
(mkConfig {
|
|
|
|
domain = "epita.fr";
|
|
|
|
address = "bruno.belanyi";
|
|
|
|
passName = "EPITA";
|
|
|
|
})
|
|
|
|
office365Config
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|