summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home/default.nix1
-rw-r--r--home/environ.nix4
-rw-r--r--home/mail.nix1
-rw-r--r--home/mail/default.nix51
-rw-r--r--home/mail/dovecot.sieve53
5 files changed, 105 insertions, 5 deletions
diff --git a/home/default.nix b/home/default.nix
index 5d92b6e..0afdc7c 100644
--- a/home/default.nix
+++ b/home/default.nix
@@ -5,6 +5,7 @@ with lib; {
./environ.nix
./graphics.nix
./isolation.nix
+ ./mail
./path.nix
];
diff --git a/home/environ.nix b/home/environ.nix
index f121b2b..b12093e 100644
--- a/home/environ.nix
+++ b/home/environ.nix
@@ -1,9 +1,5 @@
{ config, lib, pkgs, ... }:
with lib; {
- imports = [
- ./mail.nix
- ];
-
config = {
xdg.enable = true;
diff --git a/home/mail.nix b/home/mail.nix
deleted file mode 100644
index 1bb3788..0000000
--- a/home/mail.nix
+++ /dev/null
@@ -1 +0,0 @@
-# This file has been lustrated.
diff --git a/home/mail/default.nix b/home/mail/default.nix
new file mode 100644
index 0000000..38bc41e
--- /dev/null
+++ b/home/mail/default.nix
@@ -0,0 +1,51 @@
+{ config, lib, ... }:
+with lib; {
+ config = mkIf (!config.home.isolation.active) {
+ accounts.email = {
+ maildirBasePath = "mail";
+
+ accounts.local = {
+ address = "alejandro@34project.org";
+ userName = "alejandro@34project.org";
+ realName = "Alejandro Soto";
+
+ primary = true;
+
+ # ${maildirBasePath}/${maildir.path}
+ maildir.path = "";
+ folders.inbox = "";
+
+ msmtp.enable = true;
+ neomutt.enable = true;
+
+ smtp = {
+ host = "smtp.34project.org";
+
+ tls = {
+ enable = true;
+ useStartTls = true;
+ };
+ };
+ };
+ };
+
+ programs = {
+ msmtp.enable = true;
+
+ neomutt = {
+ enable = true;
+ vimKeys = true;
+
+ settings = {
+ record = "+.Sent";
+ postponed = "+.Drafts";
+
+ use_threads = "flat";
+ index_format = "'%4C %Z %<[y?%<[m?%<[d?%[%H:%M ]&%[%a %d]>&%[%b %d]>&%[%m/%y ]> %-15.15L (%?l?%4l&%4c?) %s'";
+ };
+ };
+ };
+
+ home.file.".dovecot.sieve".source = ./dovecot.sieve;
+ };
+}
diff --git a/home/mail/dovecot.sieve b/home/mail/dovecot.sieve
new file mode 100644
index 0000000..861a118
--- /dev/null
+++ b/home/mail/dovecot.sieve
@@ -0,0 +1,53 @@
+# Comando (pkgs.dovecot_pigeonhole) para filtrar mensajes existentes:
+#
+# $ sieve-filter -v -C -u alejandro@34project.org ~/.dovecot.sieve INBOX
+#
+# Ese comando es un dry-run, agregar "-W -e" para proceder. Probablemente es
+# buena idea hacer 'snapshot -r' de ~/mail antes de ejecutar eso. El primer run
+# tomó como 15 minutos para procesar todo el maildir.
+#
+# https://blog.bastelfreak.de/2020/08/dovecot-apply-sieve-filter-to-existing-emails/
+
+require ["fileinto", "mailbox"];
+
+if anyof(
+ address :is "from" ["mailer-daemon@34project.org"],
+ address :is :localpart "to" ["abuse", "security", "postmaster", "hostmaster", "sysadmin"]
+) {
+ fileinto :create "admin";
+} elsif address :is "from" "notifications@github.com" {
+ fileinto :create "github";
+} elsif address :is "from" [
+ "lwn@lwn.net",
+ "info@fsf.org"
+ ]
+{
+ fileinto :create "news";
+} elsif anyof(
+ address :is "from" [
+ "factura@factura.tigo.cr",
+ "factura_electronica@claro.cr",
+ "bcrtarjestcta@bancobcr.com"
+ ],
+
+ allof(
+ address :is "from" "bncontacto@bncr.fi.cr",
+ header :is "Subject" "Voucher Digital"
+ ),
+
+ allof(
+ address :is "from" [
+ "support-renew@gandi.net",
+ "support-es@gandi.net",
+ "support-es@support.gandi.net"
+ ],
+
+ header :contains "Subject" ["Automatic crediting", "Factura", "domain name renewed"]
+ )
+) {
+ fileinto :create "bills";
+} elsif address :is :domain ["from", "to"] ["estudiantec.cr", "itcr.ac.cr", "tec.ac.cr"] {
+ fileinto :create "tec";
+} elsif address :is :domain "from" ["turing.com", "paypal.com"] {
+ fileinto :create "spam";
+}