From a2cbf737e78051c2cb10eeaf4a5dccc19d6348ba Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sat, 7 Oct 2023 01:33:26 +0200 Subject: first working --- profiles/email/gmail.nix | 172 ++++++++++++++++++++++---------------------- profiles/email/mailsync.nix | 32 +++++---- profiles/email/neomutt.nix | 46 ++++++------ profiles/email/notmuch.nix | 10 +-- 4 files changed, 134 insertions(+), 126 deletions(-) (limited to 'profiles/email') diff --git a/profiles/email/gmail.nix b/profiles/email/gmail.nix index fa5d44e..6f2f7df 100644 --- a/profiles/email/gmail.nix +++ b/profiles/email/gmail.nix @@ -4,112 +4,114 @@ pkgs, ... }: { - accounts.email = { - maildirBasePath = "${config.xdg.dataHome}/mail"; - accounts = { - gmail = { - primary = true; - realName = "Mike Vink"; - userName = "mike1994vink@gmail.com"; - address = "mike1994vink@gmail.com"; - passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt"]; - imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; - smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; - msmtp = { + hm = { + accounts.email = { + maildirBasePath = "${config.hm.xdg.dataHome}/mail"; + accounts = { + gmail = { + primary = true; + realName = "Mike Vink"; + userName = "mike1994vink@gmail.com"; + address = "mike1994vink@gmail.com"; + passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt"]; + imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; + smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; + msmtp = { enable = true; - }; - neomutt = { - enable = true; - sendMailCommand = "msmtp -a gmail"; - mailboxName = "=== mike1994vink ==="; - extraConfig = '' + }; + neomutt = { + enable = true; + sendMailCommand = "msmtp -a gmail"; + mailboxName = "=== mike1994vink ==="; + extraConfig = '' set spoolfile='Inbox' unvirtual-mailboxes * ''; - }; - mbsync = { - enable = true; - create = "both"; remove = "both"; expunge = "both"; - groups = { - gmail = { + }; + mbsync = { + enable = true; + create = "both"; remove = "both"; expunge = "both"; + groups = { + gmail = { channels = { - Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; }; + }; }; }; - }; - notmuch = { - enable = true; - neomutt = { + notmuch = { enable = true; - virtualMailboxes = [ - { name = "Inbox"; query = "folder:/gmail/ tag:inbox"; } - { name = "Archive"; query = "folder:/gmail/ tag:archive"; } - { name = "Sent"; query = "folder:/gmail/ tag:sent"; } - { name = "Spam"; query = "folder:/gmail/ tag:spam"; } - { name = "Trash"; query = "folder:/gmail/ tag:trash"; } - { name = "Jobs"; query = "folder:/gmail/ tag:jobs"; } - { name = "Houses"; query = "folder:/gmail/ tag:houses"; } - { name = "Development"; query = "folder:/gmail/ tag:dev"; } - ]; + neomutt = { + enable = true; + virtualMailboxes = [ + { name = "Inbox"; query = "folder:/gmail/ tag:inbox"; } + { name = "Archive"; query = "folder:/gmail/ tag:archive"; } + { name = "Sent"; query = "folder:/gmail/ tag:sent"; } + { name = "Spam"; query = "folder:/gmail/ tag:spam"; } + { name = "Trash"; query = "folder:/gmail/ tag:trash"; } + { name = "Jobs"; query = "folder:/gmail/ tag:jobs"; } + { name = "Houses"; query = "folder:/gmail/ tag:houses"; } + { name = "Development"; query = "folder:/gmail/ tag:dev"; } + ]; + }; }; }; - }; - family = { - primary = false; - realName = "Natalia & Mike Vink"; - userName = "natalia.mike.vink@gmail.com"; - address = "natalia.mike.vink@gmail.com"; - passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt-family"]; - imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; - smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; - msmtp = { + family = { + primary = false; + realName = "Natalia & Mike Vink"; + userName = "natalia.mike.vink@gmail.com"; + address = "natalia.mike.vink@gmail.com"; + passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt-family"]; + imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; + smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; + msmtp = { enable = true; - }; - neomutt = { - enable = true; - sendMailCommand = "msmtp -a gmail"; - mailboxName = "=== family ==="; - extraConfig = '' + }; + neomutt = { + enable = true; + sendMailCommand = "msmtp -a gmail"; + mailboxName = "=== family ==="; + extraConfig = '' set spoolfile='Inbox' unvirtual-mailboxes * ''; - }; + }; - mbsync = { - enable = true; - create = "both"; remove = "both"; expunge = "both"; - groups = { - family = { + mbsync = { + enable = true; + create = "both"; remove = "both"; expunge = "both"; + groups = { + family = { channels = { - Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; }; + }; }; }; - }; - notmuch = { - enable = true; - neomutt = { + notmuch = { enable = true; - virtualMailboxes = [ - { name = "Inbox"; query = "folder:/family/ tag:inbox"; } - { name = "Archive"; query = "folder:/family/ tag:archive"; } - { name = "Sent"; query = "folder:/family/ tag:sent"; } - { name = "Spam"; query = "folder:/family/ tag:spam"; } - { name = "Trash"; query = "folder:/family/ tag:trash"; } - ]; + neomutt = { + enable = true; + virtualMailboxes = [ + { name = "Inbox"; query = "folder:/family/ tag:inbox"; } + { name = "Archive"; query = "folder:/family/ tag:archive"; } + { name = "Sent"; query = "folder:/family/ tag:sent"; } + { name = "Spam"; query = "folder:/family/ tag:spam"; } + { name = "Trash"; query = "folder:/family/ tag:trash"; } + ]; + }; }; }; }; diff --git a/profiles/email/mailsync.nix b/profiles/email/mailsync.nix index 3fcb0c5..8504e39 100644 --- a/profiles/email/mailsync.nix +++ b/profiles/email/mailsync.nix @@ -4,31 +4,33 @@ pkgs, ... }: { - programs.mbsync = { + hm = { + programs.mbsync = { enable = true; - }; - systemd.user.timers.mailsync = { + }; + systemd.user.timers.mailsync = { Unit = { - Description = "daemon that syncs mail"; + Description = "daemon that syncs mail"; }; Timer = { - OnBootSec = "5m"; - OnUnitActiveSec = "5m"; - Unit = "mailsync.service"; + OnBootSec = "5m"; + OnUnitActiveSec = "5m"; + Unit = "mailsync.service"; }; Install = { - WantedBy = [ "timers.target" ]; + WantedBy = [ "timers.target" ]; }; - }; - systemd.user.services.mailsync = { + }; + systemd.user.services.mailsync = { Unit = { - Description = "daemon that syncs mail"; + Description = "daemon that syncs mail"; }; Service = { - Type = "oneshot"; - RemainAfterExit = "no"; - ExecSearchPath = "${config.home.profileDirectory}/bin:/run/current-system/sw/bin"; - ExecStart = "${pkgs.coreutils}/bin/env mailsync"; + Type = "oneshot"; + RemainAfterExit = "no"; + ExecSearchPath = "${config.hm.home.profileDirectory}/bin:/run/current-system/sw/bin"; + ExecStart = "${pkgs.coreutils}/bin/env mailsync"; }; + }; }; } diff --git a/profiles/email/neomutt.nix b/profiles/email/neomutt.nix index 384173f..4106f5b 100644 --- a/profiles/email/neomutt.nix +++ b/profiles/email/neomutt.nix @@ -4,11 +4,12 @@ pkgs, ... }: { - programs.msmtp = { + hm = { + programs.msmtp = { enable = true; - }; + }; - xdg.configFile."neomutt/mailcap" = { + xdg.configFile."neomutt/mailcap" = { text = '' text/plain; $EDITOR %s ; text/html; openfile %s ; nametemplate=%s.html @@ -21,15 +22,15 @@ application/pgp-keys; gpg --import '%s'; copiousoutput; application/x-subrip; $EDITOR %s ; ''; - }; + }; - programs.neomutt = { - enable = true; - sort = "reverse-date"; - sidebar = { + programs.neomutt = { enable = true; - }; - extraConfig = '' + sort = "reverse-date"; + sidebar = { + enable = true; + }; + extraConfig = '' set use_threads=yes set send_charset="us-ascii:utf-8" set mailcap_path = $HOME/.config/neomutt/mailcap @@ -145,7 +146,7 @@ mono body bold "^gpg: BAD signature from.*" color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" ''; - binds = [ + binds = [ { map = ["index" "pager"]; key = "x"; action = "modify-labels"; } { map = ["index" "pager"]; key = "i"; action = "noop"; } { map = ["index" "pager"]; key = "g"; action = "noop"; } @@ -183,16 +184,17 @@ { map = ["pager"]; key = "\031"; action = "previous-line"; } { map = ["pager"]; key = "\005"; action = "next-line"; } { map = ["editor"]; key = ""; action = "complete-query"; } - ]; - macros = [ - { map = ["index"]; key = "X"; action = "=Spamy"; } - { map = ["index"]; key = "A"; action = "+archive -unread -inboxz^'z"; } - { map = ["index"]; key = "h"; action = "z^'z"; } - { map = ["index"]; key = "D"; action = ""; } - { map = ["index" "pager"]; key = "S"; action = "!notmuch-hook &"; } - { map = ["index"]; key = "c"; action = "?"; } - { map = ["index"]; key = "\\\\"; action = ""; } - { map = ["browser"]; key = "h"; action = ".."; } - ]; + ]; + macros = [ + { map = ["index"]; key = "X"; action = "=Spamy"; } + { map = ["index"]; key = "A"; action = "+archive -unread -inboxz^'z"; } + { map = ["index"]; key = "h"; action = "z^'z"; } + { map = ["index"]; key = "D"; action = ""; } + { map = ["index" "pager"]; key = "S"; action = "!notmuch-hook &"; } + { map = ["index"]; key = "c"; action = "?"; } + { map = ["index"]; key = "\\\\"; action = ""; } + { map = ["browser"]; key = "h"; action = ".."; } + ]; + }; }; } diff --git a/profiles/email/notmuch.nix b/profiles/email/notmuch.nix index 3b182c7..e317616 100644 --- a/profiles/email/notmuch.nix +++ b/profiles/email/notmuch.nix @@ -4,19 +4,21 @@ pkgs, ... }: { - programs.notmuch = { + hm = { + programs.notmuch = { enable = true; new = { - tags = ["new"]; - ignore = [".mbsyncstate" ".uidvalidity"]; + tags = ["new"]; + ignore = [".mbsyncstate" ".uidvalidity"]; }; search.excludeTags = ["deleted" "spam"]; maildir.synchronizeFlags = true; extraConfig = { - database.path = "${config.xdg.dataHome}/mail"; + database.path = "${config.hm.xdg.dataHome}/mail"; user.name = "Mike Vink"; user.primary_email = "mike1994vink@gmail.com"; crypto.gpg_path="gpg"; }; + }; }; } -- cgit v1.2.3