snowfield/home-manager-modules/mails/default.nix

163 lines
3.8 KiB
Nix
Raw Normal View History

{
pkgs,
config,
lib,
...
}:
2021-12-10 14:54:42 +01:00
let
cfg = config.luj.emails;
in
with lib;
{
options.luj.emails = {
enable = mkEnableOption "enable mail management";
};
2023-08-18 00:08:00 +02:00
config = mkIf cfg.enable {
age.secrets.work-mail-pw = {
file = ../../secrets/work-mail-pw.age;
};
age.secrets.dgnum-mail-pw = {
file = ../../secrets/dgnum-mail-pw.age;
};
age.secrets.telecom-mail-pw = {
file = ../../secrets/telecom-mail-pw.age;
};
age.secrets.ens-mail-pw = {
file = ../../secrets/ens-mail-pw.age;
};
2025-03-12 16:04:45 +01:00
programs.mbsync = {
enable = true;
package = pkgs.unstable.isync;
};
2023-08-18 00:08:00 +02:00
programs.msmtp.enable = true;
accounts.email = {
accounts.ens = {
2025-03-12 16:04:45 +01:00
notmuch.enable = true;
folders.inbox = "INBOX";
2023-08-18 00:08:00 +02:00
address = "julien.malka@ens.fr";
imap.host = "clipper.ens.fr";
mbsync = {
enable = true;
create = "maildir";
extraConfig.channel = {
"CopyArrivalDate" = "yes";
2021-12-10 14:54:42 +01:00
};
2023-08-18 00:08:00 +02:00
};
msmtp.enable = true;
primary = true;
realName = "Julien Malka";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.ens-mail-pw.path}";
2023-08-18 00:08:00 +02:00
smtp = {
host = "clipper.ens.fr";
};
userName = "jmalka";
};
accounts.work = {
2025-03-12 16:04:45 +01:00
notmuch.enable = true;
folders.inbox = "INBOX";
2023-08-18 00:08:00 +02:00
address = "julien@malka.sh";
2024-09-05 12:49:14 +02:00
imap.host = "mail.luj.fr";
2023-08-18 00:08:00 +02:00
mbsync = {
enable = true;
create = "maildir";
extraConfig.channel = {
"CopyArrivalDate" = "yes";
2021-12-10 14:54:42 +01:00
};
};
2023-08-18 00:08:00 +02:00
msmtp.enable = true;
primary = false;
realName = "Julien Malka";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.work-mail-pw.path}";
2023-08-18 00:08:00 +02:00
smtp = {
2024-09-05 12:49:14 +02:00
host = "mail.luj.fr";
2023-08-18 00:08:00 +02:00
};
2024-09-05 12:49:14 +02:00
userName = "malka";
2021-12-10 14:54:42 +01:00
};
2023-08-18 00:08:00 +02:00
accounts.telecom = {
2025-03-12 16:04:45 +01:00
notmuch.enable = true;
folders.inbox = "INBOX";
2023-08-18 00:08:00 +02:00
address = "julien.malka@telecom-paris.fr";
imap.host = "z.imt.fr";
mbsync = {
enable = true;
create = "maildir";
extraConfig.channel = {
"CopyArrivalDate" = "yes";
};
};
msmtp.enable = true;
primary = false;
realName = "Julien Malka";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.telecom-mail-pw.path}";
2023-08-18 00:08:00 +02:00
smtp = {
host = "z.imt.fr";
};
userName = "julien.malka@telecom-paris.fr";
2021-12-10 14:54:42 +01:00
};
2023-08-18 00:08:00 +02:00
accounts.dgnum = {
2025-03-12 16:04:45 +01:00
notmuch.enable = true;
folders.inbox = "INBOX";
2023-08-18 00:08:00 +02:00
address = "luj@dgnum.eu";
imap.host = "kurisu.lahfa.xyz";
mbsync = {
enable = true;
create = "maildir";
extraConfig.channel = {
"CopyArrivalDate" = "yes";
};
};
msmtp.enable = true;
primary = false;
realName = "Julien Malka";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.dgnum-mail-pw.path}";
2023-08-18 00:08:00 +02:00
smtp = {
host = "kurisu.lahfa.xyz";
};
userName = "luj@dgnum.eu";
2021-12-10 14:54:42 +01:00
};
2023-08-18 00:08:00 +02:00
};
2021-12-10 14:54:42 +01:00
2023-08-18 00:08:00 +02:00
services.mbsync = {
enable = true;
frequency = "minutely";
2025-03-12 16:04:45 +01:00
package = pkgs.unstable.isync;
};
services.mbsync.postExec = "${pkgs.notmuch}/bin/notmuch new";
programs.notmuch = {
enable = true;
new.tags = [ "new" ];
hooks.postNew = ''
${pkgs.afew}/bin/afew --tag --new
'';
};
programs.afew = {
enable = true;
extraConfig = ''
[FolderNameFilter]
maildir_separator = /
folder_lowercases = true
folder_blacklist = Sent
[ArchiveSentMailsFilter]
sent_tag = sent
[Filter.1]
query = tag:archive
tags = -new
[InboxFilter]
'';
2023-08-18 00:08:00 +02:00
};
};
2021-12-10 14:54:42 +01:00
}