diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-06-27 13:23:15 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-06-27 13:23:15 +0200 |
| commit | f4effc7665bf280c8587c6c65e4ee769d0244363 (patch) | |
| tree | 24a0246a65b637ef7b37c922f26bb2790e393f0a /email | |
| parent | fe1eea2ebb749fc89a56a972d03a7797b9cc36e8 (diff) | |
stuff
Diffstat (limited to 'email')
| -rw-r--r-- | email/gmail.nix | 60 | ||||
| -rw-r--r-- | email/neomutt.nix | 174 | ||||
| -rw-r--r-- | email/notmuch.nix | 26 |
3 files changed, 260 insertions, 0 deletions
diff --git a/email/gmail.nix b/email/gmail.nix new file mode 100644 index 0000000..a883b17 --- /dev/null +++ b/email/gmail.nix @@ -0,0 +1,60 @@ +{ + flake, + config, + pkgs, + home-manager, + ... +}: { + 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; }; }; + neomutt = { + enable = true; + sendMailCommand = "echo 'hi'"; + mailboxName = "=== gmail ==="; + extraConfig = '' + set spoolfile='Inbox' + ''; + }; + mbsync = { + enable = true; + create = "both"; remove = "both"; expunge = "both"; + groups = { + mailboxes = { + channels = { + Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; }; }; + Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; }; }; + Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; }; }; + Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; }; }; + Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; }; }; + Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; }; }; + FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; }; }; + }; + }; + }; + }; + notmuch = { + enable = true; + neomutt = { + enable = true; + virtualMailboxes = [ + { name = "Inbox"; query = "tag:inbox"; } + { name = "Archive"; query = "tag:archive"; } + { name = "Sent"; query = "tag:sent"; } + { name = "Spam"; query = "tag:spam"; } + { name = "Trash"; query = "tag:trash"; } + ]; + }; + }; + }; + }; + }; +} diff --git a/email/neomutt.nix b/email/neomutt.nix new file mode 100644 index 0000000..b8bc848 --- /dev/null +++ b/email/neomutt.nix @@ -0,0 +1,174 @@ +{ + flake, + config, + pkgs, + home-manager, + ... +}: { + programs.neomutt = { + enable = true; + sort = "reverse-date"; + extraConfig = '' + set use_threads=yes + set send_charset="us-ascii:utf-8" + set mailcap_path = $HOME/.config/mutt/mailcap + set mime_type_query_command = "file --mime-type -b %s" + set date_format="%y/%m/%d %I:%M%p" + set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" + set smtp_authenticators = 'gssapi:login' + set query_command = "abook --mutt-query '%s'" + set rfc2047_parameters = yes + set sleep_time = 0 # Pause 0 seconds for informational messages + set markers = no # Disables the `+` displayed at line wraps + set mark_old = no # Unread mail stay unread until read + set mime_forward = no # mail body is forwarded as text + set forward_attachments = yes # attachments are forwarded with mail + set wait_key = no # mutt won't ask "press key to continue" + set fast_reply # skip to compose when replying + set fcc_attach # save attachments with the body + set forward_format = "Fwd: %s" # format of subject when forwarding + set forward_quote # include message in forwards + set reverse_name # reply as whomever it was to + set include # include message in replies + set mail_check=0 # to avoid lags using IMAP with some email providers (yahoo for example) + auto_view text/html # automatically show html (mailcap uses lynx) + auto_view application/pgp-encrypted + #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. + alternative_order text/plain text/enriched text/html + + set sidebar_visible = yes + set sidebar_width = 20 + set sidebar_short_path = yes + set sidebar_next_new_wrap = yes + set mail_check_stats + set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' + bind index,pager \Ck sidebar-prev + bind index,pager \Cj sidebar-next + bind index,pager \Co sidebar-open + bind index,pager \Cp sidebar-prev-new + bind index,pager \Cn sidebar-next-new + bind index,pager B sidebar-toggle-visible + + # Default index colors: + color index yellow default '.*' + color index_author red default '.*' + color index_number blue default + color index_subject cyan default '.*' + + # New mail is boldened: + color index brightyellow black "~N" + color index_author brightred black "~N" + color index_subject brightcyan black "~N" + + # Tagged mail is highlighted: + color index brightyellow blue "~T" + color index_author brightred blue "~T" + color index_subject brightcyan blue "~T" + + # Flagged mail is highlighted: + color index brightgreen default "~F" + color index_subject brightgreen default "~F" + color index_author brightgreen default "~F" + + # Other colors and aesthetic settings: + mono bold bold + mono underline underline + mono indicator reverse + mono error bold + color normal default default + color indicator brightblack white + color sidebar_highlight red default + color sidebar_divider brightblack black + color sidebar_flagged red black + color sidebar_new green black + color error red default + color tilde black default + color message cyan default + color markers red white + color attachment white default + color search brightmagenta default + color status brightyellow black + color hdrdefault brightgreen default + color quoted green default + color quoted1 blue default + color quoted2 cyan default + color quoted3 yellow default + color quoted4 red default + color quoted5 brightred default + color signature brightgreen default + color bold black default + color underline black default + + # Regex highlighting: + color header brightmagenta default "^From" + color header brightcyan default "^Subject" + color header brightwhite default "^(CC|BCC)" + color header blue default ".*" + color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses + color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL + color body green default "\`[^\`]*\`" # Green text between ` and ` + color body brightblue default "^# \.*" # Headings as bold blue + color body brightcyan default "^## \.*" # Subheadings as bold cyan + color body brightgreen default "^### \.*" # Subsubheadings as bold green + color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow + color body brightcyan default "[;:][-o][)/(|]" # emoticons + color body brightcyan default "[;:][)(|]" # emoticons + color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? + color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? + color body red default "(BAD signature)" + color body cyan default "(Good signature)" + color body brightblack default "^gpg: Good signature .*" + color body brightyellow default "^gpg: " + color body brightyellow red "^gpg: BAD signature from.*" + mono body bold "^gpg: Good signature" + 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<>\"]" + ''; + sidebar = { + enable = true; + }; + binds = [ + { map = ["index" "pager"]; key = "i"; action = "noop"; } + { map = ["index" "pager"]; key = "g"; action = "noop"; } + { map = ["index"]; key = "\\Cf"; action = "noop"; } + { map = ["index" "pager"]; key = "M"; action = "noop"; } + { map = ["index" "pager"]; key = "C"; action = "noop"; } + { map = ["index"]; key = "gg"; action = "first-entry"; } + { map = ["index"]; key = "j"; action = "next-entry"; } + { map = ["index"]; key = "k"; action = "previous-entry"; } + { map = ["attach"]; key = "<return>"; action = "view-mailcap"; } + { map = ["attach"]; key = "l"; action = "view-mailcap"; } + { map = ["editor"]; key = "<space>"; action = "noop"; } + { map = ["index"]; key = "G"; action = "last-entry"; } + { map = ["pager" "attach"]; key = "h"; action = "exit"; } + { map = ["pager"]; key = "j"; action = "next-line"; } + { map = ["pager"]; key = "k"; action = "previous-line"; } + { map = ["pager"]; key = "l"; action = "view-attachments"; } + { map = ["index"]; key = "D"; action = "delete-message"; } + { map = ["index"]; key = "U"; action = "undelete-message"; } + { map = ["index"]; key = "L"; action = "limit"; } + { map = ["index"]; key = "h"; action = "noop"; } + { map = ["index"]; key = "l"; action = "display-message"; } + { map = ["index" "query"]; key = "<space>"; action = "tag-entry"; } + { map = ["index" "pager"]; key = "H"; action = "view-raw-message"; } + { map = ["browser"]; key = "l"; action = "select-entry"; } + { map = ["browser"]; key = "gg"; action = "top-page"; } + { map = ["browser"]; key = "G"; action = "bottom-page"; } + { map = ["pager"]; key = "gg"; action = "top"; } + { map = ["pager"]; key = "G"; action = "bottom"; } + { map = ["index" "pager" "browser"]; key = "d"; action = "half-down"; } + { map = ["index" "pager" "browser"]; key = "u"; action = "half-up"; } + { map = ["index" "pager"]; key = "S"; action = "sync-mailbox"; } + { map = ["index" "pager"]; key = "R"; action = "group-reply"; } + { map = ["index"]; key = "\031"; action = "previous-undeleted"; } + { map = ["index"]; key = "\005"; action = "next-undeleted"; } + { map = ["pager"]; key = "\031"; action = "previous-line"; } + { map = ["pager"]; key = "\005"; action = "next-line"; } + { map = ["editor"]; key = "<Tab>"; action = "complete-query"; } + ]; + macros = [ + { map = ["browser"]; key = "h"; action = "<change-dir><kill-line>..<enter>"; } + { map = ["index"]; key = "<right>"; action = "<enter-command>toggle sidebar_visible<enter><refresh>"; } + ]; + }; +} diff --git a/email/notmuch.nix b/email/notmuch.nix new file mode 100644 index 0000000..15bfcd9 --- /dev/null +++ b/email/notmuch.nix @@ -0,0 +1,26 @@ +{ + flake, + config, + pkgs, + home-manager, + ... +}: { + programs.mbsync = { + enable = true; + }; + programs.notmuch = { + enable = true; + new = { + tags = ["unread" "inbox"]; + ignore = [".mbsyncstate" ".uidvalidity"]; + }; + search.excludeTags = ["deleted" "spam"]; + maildir.synchronizeFlags = true; + extraConfig = { + database.path = "${config.xdg.dataHome}/mail"; + user.name = "Mike Vink"; + user.primary_email = "mike1994vink@gmail.com"; + crypto.gpg_path="gpg"; + }; + }; +} |
