nix-config/modules/home/mail/accounts/default.nix
Bruno BELANYI a5aaf57e63 home: mail: accounts: remove himalaya backends
Their definition is redundant with the logic of the himalaya module,
which does the right thing by default.
2024-02-06 17:16:47 +01:00

93 lines
1.9 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.my.home.mail;
inherit (lib.my) mkMailAddress;
mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: {
realName = lib.mkDefault "Bruno BELANYI";
userName = lib.mkDefault (mkMailAddress address domain);
passwordCommand =
lib.mkDefault [ (lib.getExe pkgs.ambroisie.rbw-pass) "Mail" passName ];
address = mkMailAddress address domain;
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;
inherit primary;
himalaya = {
enable = cfg.himalaya.enable;
# FIXME: try to actually configure it at some point
};
msmtp = {
enable = cfg.msmtp.enable;
};
};
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 = {
flavor = "outlook.office365.com";
};
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
];
};
}