2019-08-27 17:24:33 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
2020-04-18 08:46:42 +02:00
|
|
|
let
|
2020-09-24 10:35:53 +02:00
|
|
|
generateTaggingScript = filters:
|
2020-09-24 11:12:52 +02:00
|
|
|
let
|
|
|
|
|
template = { tags, query, message ? "tagging ${query} -> ${lib.concatStringsSep " " tags}", ... }: ''
|
2020-09-24 10:35:53 +02:00
|
|
|
echo '${message}'
|
2020-09-24 11:12:52 +02:00
|
|
|
${pkgs.notmuch}/bin/notmuch tag ${lib.concatStringsSep " " tags} -- "${query}"
|
|
|
|
|
'';
|
|
|
|
|
in lib.concatStringsSep "\n" (map template filters);
|
2020-09-24 10:35:53 +02:00
|
|
|
|
|
|
|
|
taggingConfig = [
|
|
|
|
|
{
|
|
|
|
|
query = "from:nebenan.de";
|
|
|
|
|
tags = [ "-inbox" "-unread" ];
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
query = "subject:fd-noti";
|
|
|
|
|
tags = [ "-inbox -unread" ];
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
query = "subject:miaEngiadina AND subject:\"PR run failed\"";
|
|
|
|
|
tags = [ "+deleted" ];
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2020-04-18 08:46:42 +02:00
|
|
|
pass = id: "${pkgs.pass}/bin/pass ${id}";
|
2020-04-25 21:34:26 +02:00
|
|
|
enableDefaults = lib.recursiveUpdate {
|
|
|
|
|
mbsync = {
|
|
|
|
|
enable = true;
|
|
|
|
|
create = "both";
|
|
|
|
|
expunge = "both";
|
|
|
|
|
};
|
|
|
|
|
msmtp.enable = true;
|
2020-09-23 00:33:30 +02:00
|
|
|
notmuch.enable = true;
|
2020-04-25 21:34:26 +02:00
|
|
|
};
|
2020-09-24 11:12:52 +02:00
|
|
|
|
|
|
|
|
much-pkg = pkgs.haskellPackages.callCabal2nix "much" <niveum/submodules/much> {};
|
|
|
|
|
much = pkgs.haskell.lib.dontHaddock much-pkg;
|
2020-06-10 17:37:25 +02:00
|
|
|
in {
|
2020-09-24 10:35:53 +02:00
|
|
|
environment.systemPackages = [
|
|
|
|
|
pkgs.neomutt
|
2020-09-24 11:12:52 +02:00
|
|
|
|
|
|
|
|
(pkgs.writers.writeDashBin "mua" ''
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
|
${much}/bin/much-kmein
|
|
|
|
|
else
|
|
|
|
|
${much}/bin/much-kmein -q "$@"
|
|
|
|
|
fi
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(pkgs.writers.writeDashBin "mail-fetch" ''
|
2020-09-24 10:35:53 +02:00
|
|
|
${pkgs.isync}/bin/mbsync --all
|
|
|
|
|
${pkgs.notmuch}/bin/notmuch new
|
|
|
|
|
'')
|
2020-09-24 11:12:52 +02:00
|
|
|
|
|
|
|
|
(pkgs.writers.writeDashBin "mail-rm-deleted" ''
|
2020-09-24 10:35:53 +02:00
|
|
|
${pkgs.notmuch}/bin/notmuch search --output files --format=text0 tag:deleted | ${pkgs.findutils}/bin/xargs -r0 rm
|
|
|
|
|
${pkgs.notmuch}/bin/notmuch new
|
|
|
|
|
'')
|
|
|
|
|
];
|
2019-04-20 09:08:39 +02:00
|
|
|
|
2020-09-24 11:12:52 +02:00
|
|
|
home-manager.users.me = {
|
|
|
|
|
programs.msmtp.enable = true;
|
|
|
|
|
|
|
|
|
|
programs.mbsync.enable = true;
|
|
|
|
|
|
|
|
|
|
programs.notmuch = {
|
|
|
|
|
enable = true;
|
|
|
|
|
new.tags = [ "unread" "inbox" ];
|
|
|
|
|
search.excludeTags = [ "deleted" "spam" ];
|
|
|
|
|
hooks.postNew = generateTaggingScript taggingConfig;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
accounts.email.maildirBasePath = "${config.users.users.me.home}/mail";
|
|
|
|
|
|
2020-04-22 17:42:45 +02:00
|
|
|
accounts.email.accounts = {
|
2020-09-24 11:12:52 +02:00
|
|
|
fysi = enableDefaults {
|
2020-07-25 09:04:12 +02:00
|
|
|
primary = false;
|
|
|
|
|
smtp = {
|
|
|
|
|
host = "smtp.fastmail.com";
|
|
|
|
|
port = 465;
|
|
|
|
|
tls.enable = true;
|
|
|
|
|
};
|
|
|
|
|
imap = {
|
|
|
|
|
host = "imap.fastmail.com";
|
|
|
|
|
port = 993;
|
|
|
|
|
tls.enable = true;
|
|
|
|
|
};
|
|
|
|
|
userName = "kieran@fysi.tech";
|
|
|
|
|
address = "kieran@fysi.tech";
|
|
|
|
|
realName = config.niveum.user.name;
|
|
|
|
|
passwordCommand = pass "mail/kieran@fysi.tech";
|
2020-09-24 11:12:52 +02:00
|
|
|
};
|
|
|
|
|
cock = enableDefaults {
|
2020-04-25 21:34:26 +02:00
|
|
|
primary = false;
|
|
|
|
|
smtp = {
|
|
|
|
|
host = "mail.cock.li";
|
|
|
|
|
port = 587;
|
2020-07-14 23:51:07 +02:00
|
|
|
tls = {
|
|
|
|
|
enable = true;
|
|
|
|
|
useStartTls = true;
|
|
|
|
|
};
|
2020-04-25 21:34:26 +02:00
|
|
|
};
|
|
|
|
|
imap = {
|
|
|
|
|
host = "mail.cock.li";
|
|
|
|
|
port = 993;
|
|
|
|
|
tls.enable = true;
|
|
|
|
|
};
|
|
|
|
|
userName = "2210@cock.li";
|
|
|
|
|
address = "2210@cock.li";
|
|
|
|
|
realName = "2210";
|
|
|
|
|
passwordCommand = pass "mail/2210@cock.li";
|
2020-09-24 11:12:52 +02:00
|
|
|
};
|
|
|
|
|
kieran-gmail = enableDefaults {
|
|
|
|
|
primary = false;
|
|
|
|
|
flavor = "gmail.com";
|
|
|
|
|
address = "kieran.meinhardt@gmail.com";
|
|
|
|
|
realName = config.niveum.user.name;
|
|
|
|
|
userName = "kieran.meinhardt";
|
|
|
|
|
passwordCommand = pass "mail/kieran.meinhardt@gmail.com";
|
|
|
|
|
folders = {
|
|
|
|
|
drafts = "[Gmail]/Entw&APw-rfe";
|
|
|
|
|
sent = "[Gmail]/Gesendet";
|
|
|
|
|
trash = "[Gmail]/Papierkorb";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
amroplay = enableDefaults {
|
|
|
|
|
primary = false;
|
|
|
|
|
flavor = "gmail.com";
|
|
|
|
|
address = "amroplay@gmail.com";
|
|
|
|
|
realName = config.niveum.user.name;
|
|
|
|
|
userName = "amroplay";
|
|
|
|
|
passwordCommand = pass "mail/amroplay@gmail.com";
|
|
|
|
|
folders = {
|
|
|
|
|
drafts = "[Gmail]/Drafts";
|
|
|
|
|
sent = "[Gmail]/Sent Mail";
|
|
|
|
|
trash = "[Gmail]/Bin";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
posteo = enableDefaults {
|
|
|
|
|
primary = true;
|
|
|
|
|
smtp = {
|
|
|
|
|
host = "posteo.de";
|
|
|
|
|
port = 587;
|
|
|
|
|
tls = {
|
|
|
|
|
enable = true;
|
|
|
|
|
useStartTls = true;
|
2020-09-21 14:48:21 +02:00
|
|
|
};
|
2020-09-24 11:12:52 +02:00
|
|
|
};
|
|
|
|
|
imap = {
|
|
|
|
|
host = "posteo.de";
|
|
|
|
|
port = 993;
|
|
|
|
|
tls.enable = true;
|
|
|
|
|
};
|
|
|
|
|
address = "kieran.meinhardt@posteo.net";
|
|
|
|
|
realName = config.niveum.user.name;
|
|
|
|
|
userName = "kieran.meinhardt@posteo.net";
|
|
|
|
|
passwordCommand = pass "shared/posteo/password";
|
|
|
|
|
};
|
|
|
|
|
hu-berlin = enableDefaults {
|
2020-04-22 17:42:45 +02:00
|
|
|
primary = false;
|
|
|
|
|
address = "meinhark@hu-berlin.de";
|
|
|
|
|
realName = config.niveum.user.name;
|
|
|
|
|
userName = "meinhark";
|
|
|
|
|
passwordCommand = pass "shared/eduroam/password";
|
|
|
|
|
smtp = {
|
|
|
|
|
host = "mailhost.cms.hu-berlin.de";
|
|
|
|
|
port = 25;
|
2020-07-14 23:51:07 +02:00
|
|
|
tls = {
|
|
|
|
|
enable = true;
|
|
|
|
|
useStartTls = true;
|
|
|
|
|
};
|
2020-04-22 17:42:45 +02:00
|
|
|
};
|
|
|
|
|
imap = {
|
|
|
|
|
host = "mailbox.cms.hu-berlin.de";
|
|
|
|
|
port = 993;
|
|
|
|
|
tls.enable = true;
|
|
|
|
|
};
|
2020-04-18 17:58:44 +02:00
|
|
|
};
|
2020-09-24 10:35:53 +02:00
|
|
|
};
|
2019-04-20 09:08:39 +02:00
|
|
|
};
|
|
|
|
|
}
|