mail improvements

This commit is contained in:
Ingolf Wagner 2022-01-16 11:59:40 +01:00
parent 0efadc588d
commit 2abf05bc0f
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
5 changed files with 171 additions and 129 deletions

View file

@ -62,11 +62,11 @@
"secrets": { "secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1640976355, "lastModified": 1642323992,
"narHash": "sha256-OWreLkiCSvvGx5RotyIAzZWgrPEiRGQXipIYIUByzEI=", "narHash": "sha256-neExsJomuWP9/lv1VcXCAYOQ0L7qPAnx8q0YbFA2zpQ=",
"ref": "main", "ref": "main",
"rev": "16bbe8a0157d5aa669b2572cda7186a2f108e676", "rev": "c6b452df2d10b24e21b746b09f1ff5b1fd9ee850",
"revCount": 27, "revCount": 28,
"type": "git", "type": "git",
"url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git" "url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git"
}, },

View file

@ -44,6 +44,10 @@ let
"from:vstbuzz.com" "from:vstbuzz.com"
]; ];
filters = [ filters = [
{
query = "from:hosting.de";
tags = [ "+billing" ];
}
{ {
query = "from:hv-geelen.de"; query = "from:hv-geelen.de";
tags = [ "+wohnung" ]; tags = [ "+wohnung" ];
@ -428,8 +432,7 @@ in
hashedPassword = "!"; hashedPassword = "!";
name = "mailfetcher"; name = "mailfetcher";
home = "/home/mailfetcher"; home = "/home/mailfetcher";
openssh.authorizedKeys.keyFiles = openssh.authorizedKeys.keyFiles = config.users.users.root.openssh.authorizedKeys.keyFiles;
config.users.users.root.openssh.authorizedKeys.keyFiles;
group = "mailfetcher"; group = "mailfetcher";
}; };
@ -437,6 +440,10 @@ in
name = "mailfetcher"; name = "mailfetcher";
}; };
sops.secrets.mail_ingolf_wagner_de = {
owner = config.users.users.mailUser.name;
group = config.users.users.mailUser.group;
};
sops.secrets.mail_terranix = { sops.secrets.mail_terranix = {
owner = config.users.users.mailUser.name; owner = config.users.users.mailUser.name;
group = config.users.users.mailUser.group; group = config.users.users.mailUser.group;
@ -561,13 +568,41 @@ in
tls.enable = true; tls.enable = true;
port = 993; port = 993;
}; };
mbsync = { # make sure the upstream mail is deleted
getmail = {
enable = true; enable = true;
create = "both"; delete = true;
readAll = false;
mailboxes = [ "ALL" ];
}; };
notmuch.enable = true; notmuch.enable = true;
}; };
# new
ingolf-wagner-de-new = {
primary = false;
address = "contact@ingolf-wagner.de";
aliases = [ ];
realName = "Ingolf Wagner";
userName = "contact@ingolf-wagner.de";
passwordCommand =
"cat ${toString config.sops.secrets.mail_ingolf_wagner_de.path}";
imap = {
host = "mail.privateemail.com";
tls.enable = true;
port = 993;
};
# make sure the upstream mail is deleted
getmail = {
enable = true;
delete = true;
readAll = false;
mailboxes = [ "ALL" ];
};
notmuch.enable = true;
};
# deprecated
ingolf-wagner-de = { ingolf-wagner-de = {
primary = false; primary = false;
address = "contact@ingolf-wagner.de"; address = "contact@ingolf-wagner.de";
@ -635,14 +670,14 @@ in
echo "run getmail" echo "run getmail"
${pkgs.getmail}/bin/getmail \ ${pkgs.getmail}/bin/getmail \
--quiet \ --quiet \
--rcfile getmailingolf-wagner-de --rcfile getmailingolf-wagner-de \
--rcfile getmailingolf-wagner-de-new \
--rcfile getmailterranix_org
echo "run notmuch" echo "run notmuch"
${pkgs.notmuch}/bin/notmuch new ${pkgs.notmuch}/bin/notmuch new
${notmuchTaggingNew} ${notmuchTaggingNew}
${threadTag "muted"} ${threadTag "muted"}
${threadTag "mute"}
${threadTag "ignore"}
''; '';
}; };
systemd.timers.fetchmail = { systemd.timers.fetchmail = {

View file

@ -9,7 +9,6 @@
user = "palo"; user = "palo";
dataDir = "/home/palo/.syncthing"; dataDir = "/home/palo/.syncthing";
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
declarative = {
cert = toString config.sops.secrets.syncthing_cert.path; cert = toString config.sops.secrets.syncthing_cert.path;
key = toString config.sops.secrets.syncthing_key.path; key = toString config.sops.secrets.syncthing_key.path;
overrideFolders = true; overrideFolders = true;
@ -71,7 +70,6 @@
}; };
}; };
};
system.permown."/home/palo/music-library" = { system.permown."/home/palo/music-library" = {
owner = "palo"; owner = "palo";

View file

@ -85,7 +85,11 @@ with lib;
publicKey = publicKey =
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZuvHooyHa69rU+SfOghM6yfc7bce5cMi9sh5JkoLPi+m8QEkX3oiG9rRpAhp0GYnB74M4l1+0XlxmG7/HVmq0="; "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZuvHooyHa69rU+SfOghM6yfc7bce5cMi9sh5JkoLPi+m8QEkX3oiG9rRpAhp0GYnB74M4l1+0XlxmG7/HVmq0=";
}; };
"cracksucht.de" = {
hostNames = [ "cracksucht.de" ];
publicKey =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVqpWzX+C7veO/1MDSdh5ukFhpI4cfXevbl6DVb9gVt1wdYB0JsiMiWfl13MZJy9iEP/KfwRLYmu8i36tDR9uJfHQyLK8G7q2DhrleIPgM3dFCdDU1QtulE8hEq/ZsqzMn/QIHYIipIqzNfmC/xnpX2gIo09T7EY+n863ALlj+GqxMb4nr2XDLY+Lllo2yMzylJIz9q8U5hOmzrlCnBpf2MPMwanHXnZXj2CmO80VyBHnAMJ/h72AN1qzDaHFlhxh0Li/POc1bpDjiVjiUPgimHZWpi3VObxWLLn2zf+RH2lx0yXMccSEnkWvHp+Ll5apIUUS+vTlDo3niWpEfGZLl root@debian";
};
}; };
} }

View file

@ -5,6 +5,7 @@ let
in in
{ {
# Maildir <-> Server communication # Maildir <-> Server communication
# -------------------------------- # --------------------------------
# mbsync: MailDir <-> IMAP # mbsync: MailDir <-> IMAP
@ -20,48 +21,45 @@ in
# neomutt # neomutt
home-manager.users.mainUser.accounts.email.accounts = { home-manager.users.mainUser.accounts.email.accounts = {
palo_van_dalo-gmx = { #palo_van_dalo-gmx = {
primary = false; # address = "palo_van_dalo@gmx.de";
address = "palo_van_dalo@gmx.de"; # aliases = [ ];
aliases = [ ]; # realName = "Ingolf Wagner";
realName = "Ingolf Wagner"; # userName = "palo_van_dalo@gmx.de";
userName = "palo_van_dalo@gmx.de"; # passwordCommand = passcmd "mail/gmx/palo_van_dalo@gmx.de";
passwordCommand = passcmd "mail/gmx/palo_van_dalo@gmx.de"; # smtp = {
smtp = { # host = "smtp.gmx.net";
host = "smtp.gmx.net"; # port = 465;
port = 465; # };
}; # notmuch.enable = true;
notmuch.enable = true; # msmtp = { enable = true; };
msmtp = { enable = true; }; #};
}; #ingolf-wagner-gmx = {
ingolf-wagner-gmx = { # address = "ingolf.wagner@gmx.de";
primary = false; # aliases = [ ];
address = "ingolf.wagner@gmx.de"; # realName = "Ingolf Wagner";
aliases = [ ]; # userName = "ingolf.wagner@gmx.de";
realName = "Ingolf Wagner"; # passwordCommand = passcmd "mail/gmx/ingolf.wagner@gmx.de";
userName = "ingolf.wagner@gmx.de"; # smtp = {
passwordCommand = passcmd "mail/gmx/ingolf.wagner@gmx.de"; # host = "smtp.gmx.net";
smtp = { # port = 465;
host = "smtp.gmx.net"; # };
port = 465; # notmuch.enable = true;
}; # msmtp = { enable = true; };
notmuch.enable = true; #};
msmtp = { enable = true; }; #pali_palo = {
}; # address = "pali_palo@web.de";
pali_palo = { # aliases = [ ];
primary = false; # realName = "Ingolf Wagner";
address = "pali_palo@web.de"; # userName = "pali_palo@web.de";
aliases = [ ]; # passwordCommand = passcmd "mail/web.de/pali_palo@web.de";
realName = "Ingolf Wagner"; # smtp = {
userName = "pali_palo@web.de"; # host = "smtp.web.de";
passwordCommand = passcmd "mail/web.de/pali_palo@web.de"; # port = 465;
smtp = { # };
host = "smtp.web.de"; # notmuch.enable = true;
port = 465; # msmtp = { enable = true; };
}; #};
notmuch.enable = true;
msmtp = { enable = true; };
};
gmail = { gmail = {
# for google accounts you have to allow 'less secure apps' in accounts.google.com # for google accounts you have to allow 'less secure apps' in accounts.google.com
primary = true; primary = true;
@ -77,7 +75,6 @@ in
notmuch.enable = true; notmuch.enable = true;
msmtp = { msmtp = {
enable = true; enable = true;
# msmtp --serverinfo --tls --tls-certcheck=off -a gmail
}; };
gpg = { gpg = {
encryptByDefault = true; encryptByDefault = true;
@ -86,7 +83,6 @@ in
}; };
}; };
terranix_org = { terranix_org = {
primary = false;
address = "palo@terranix.org"; address = "palo@terranix.org";
aliases = [ ]; aliases = [ ];
realName = "Ingolf Wagner"; realName = "Ingolf Wagner";
@ -99,33 +95,28 @@ in
notmuch.enable = true; notmuch.enable = true;
msmtp = { msmtp = {
enable = true; enable = true;
# msmtp --serverinfo --tls --tls-certcheck=off -a gmail
}; };
}; };
ingolf-wagner = { ingolf-wagner = {
primary = false;
address = "contact@ingolf-wagner.de"; address = "contact@ingolf-wagner.de";
aliases = [ ]; aliases = [ ];
realName = "Ingolf Wagner"; realName = "Ingolf Wagner";
userName = "contact@ingolf-wagner.de"; userName = "contact@ingolf-wagner.de";
passwordCommand = passcmd "mail/siteground/contact@ingolf-wagner.de"; passwordCommand = passcmd "mail/namecheap/contact@ingolf-wagner.de";
notmuch.enable = true; notmuch.enable = true;
smtp = {
host = "securees5.sgcpanel.com";
port = 587;
tls.useStartTls = true;
};
msmtp = {
enable = true;
# msmtp --serverinfo --tls --tls-certcheck=off -a ingolf-wagner
tls.fingerprint =
"16:94:47:E0:00:86:BB:F7:56:D3:81:F1:89:7B:CD:67:65:0B:EE:0B:A9:26:96:5E:0B:1F:56:AB:FD:DE:96:C5";
};
gpg = { gpg = {
encryptByDefault = true; encryptByDefault = true;
signByDefault = true; signByDefault = true;
key = "42AC51C9482D0834CF488AF1389EC2D64AC71EAC"; key = "42AC51C9482D0834CF488AF1389EC2D64AC71EAC";
}; };
smtp = {
host = "mail.privateemail.com";
port = 465;
};
msmtp = {
enable = true;
# msmtp --serverinfo --tls --tls-certcheck=off -a ingolf-wagner
};
}; };
}; };
@ -392,6 +383,19 @@ in
${notmuch} search --output=files --exclude=false tag:deleted | while read line; do rm -v "$line" ; done ${notmuch} search --output=files --exclude=false tag:deleted | while read line; do rm -v "$line" ; done
${notmuch} new ${notmuch} new
''; '';
plot_maildir =
let
years = [ 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 ];
file = "~/Maildir/usage.csv";
append_year = year: ''
echo -n "${toString year}," >> ${file}
${pkgs.notmuch}/bin/notmuch count -- date:${toString year} >> ${file}
'';
in
pkgs.writers.writeBashBin "mail-create-statistics" ''
rm ${file}
${lib.concatStringsSep "\n" (map append_year years)}
'';
in in
[ [
@ -404,6 +408,7 @@ in
pkgs.neomutt pkgs.neomutt
mutt mutt
mailDelete mailDelete
plot_maildir
]; ];
} }