about summary refs log tree commit diff
path: root/home/profiles
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-02-13 21:06:47 +0900
committersefidel <contact@sefidel.net>2022-02-13 21:06:52 +0900
commit93e013e835d06e1bc88496bdf068c9a6ef8a2204 (patch)
treedf884e772411cd798fa9e9b0f15b75bafd9ebd88 /home/profiles
parentb0ad20a31cc215b250043e0dad5024122dc2b578 (diff)
downloadnixrc-93e013e835d06e1bc88496bdf068c9a6ef8a2204.tar.gz
nixrc-93e013e835d06e1bc88496bdf068c9a6ef8a2204.zip
feat: aerc -> neomutt
Diffstat (limited to 'home/profiles')
-rw-r--r--home/profiles/base/default.nix1
-rw-r--r--home/profiles/messaging/default.nix172
2 files changed, 171 insertions, 2 deletions
diff --git a/home/profiles/base/default.nix b/home/profiles/base/default.nix
index fd34090..9c97d5f 100644
--- a/home/profiles/base/default.nix
+++ b/home/profiles/base/default.nix
@@ -85,6 +85,7 @@ in
       pkgs.hydra-check
       pkgs.libnotify
       pkgs.nix-tree
+      pkgs.pass
       pkgs.procs
       pkgs.sops
       pkgs.tree
diff --git a/home/profiles/messaging/default.nix b/home/profiles/messaging/default.nix
index 0af65c9..a5a52eb 100644
--- a/home/profiles/messaging/default.nix
+++ b/home/profiles/messaging/default.nix
@@ -1,5 +1,9 @@
 { config, lib, pkgs, ... }:
-let cfg = config.profiles.messaging;
+let
+  cfg = config.profiles.messaging;
+
+  poorObfuscation = y: x: "${x}@${y}";
+  mailPass = x: "${pkgs.pass}/bin/pass show emails/${x}";
 in
 {
   imports = [ ../../modules/programs/nixpkgs ];
@@ -10,8 +14,172 @@ in
   };
 
   config = lib.mkIf cfg.enable {
+    accounts.email = {
+      accounts.zach = {
+        address = poorObfuscation "zachel.io" "zach";
+        gpg = {
+          key = "346833414516C852FFB238E19F734565641C2F14";
+          signByDefault = true;
+        };
+
+        imap.host = "imap.migadu.com";
+        smtp.host = "smtp.migadu.com";
+
+        mbsync = {
+          enable = true;
+          create = "maildir";
+        };
+
+        msmtp.enable = true;
+        notmuch.enable = true;
+        neomutt.enable = true;
+        neomutt.mailboxName = "zach";
+
+        imapnotify = {
+          enable = true;
+          boxes = [ "Inbox" ];
+          onNotify = pkgs.writeShellScript "imap-on-notify" ''
+            mbsync zach
+            NOTMUCH_CONFIG=${lib.escapeShellArg config.home.sessionVariables.NOTMUCH_CONFIG}
+            NMBGIT=${lib.escapeShellArg config.home.sessionVariables.NMBGIT}
+            ${pkgs.notmuch}/bin/notmuch new
+          '';
+        };
+
+        primary = true;
+        realName = "zachel";
+        userName = poorObfuscation "zachel.io" "zach";
+        passwordCommand = mailPass "zach";
+      };
+    };
+
+    programs.mbsync.enable = true;
+    programs.msmtp.enable = true;
+    programs.notmuch = {
+      enable = true;
+      hooks.preNew = "mbsync --all";
+    };
+
+    programs.neomutt = {
+      enable = true;
+      sidebar.enable = true;
+      sidebar.format = "%D%?F? [%F]?%* %?N?*N/?%S";
+
+      sort = "reverse-threads";
+
+      settings = {
+        date_format = ''"%y/%m/%d %I:%M%p"'';
+        index_format = ''"%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)"'';
+        query_command = ''"abook --mutt-query '%s'"'';
+        rfc2047_parameters = "yes";
+        # Pause 0 seconds for informational messages
+        sleep_time = "0";
+        # Disables the `+` displayed at line wraps
+        markers = "no";
+        # Unread mail stay unread until read;
+        mark_old = "no";
+        # attachments are forwarded with mail;
+        mime_forward = "yes";
+        # mutt won't ask "press key to continue";
+        wait_key = "no";
+        # skip to compose when replying
+        fast_reply = "yes";
+        # save attachments with the body
+        fcc_attach = "yes";
+        # format of subject when forwarding;
+        forward_format = ''"Fwd: %s"'';
+        # include message in forwards
+        forward_quote = "yes";
+        # reply as whomever it was to
+        reverse_name = "yes";
+        # include message in replies
+        include = "yes";
+      };
+
+      extraConfig = ''
+        # 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"
+
+
+        # 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 normal brightyellow default
+        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
+        color normal default default
+
+
+        # Regex highlighting:
+        color header blue default ".*"
+        color header brightmagenta default "^(From)"
+        color header brightcyan default "^(Subject)"
+        color header brightwhite default "^(CC|BCC)"
+        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<>\"]"
+      '';
+    };
+
+    programs.notmuch.hooks.postNew = ''
+      ${pkgs.libnotify}/bin/notify-send --icon=mail-unread --app-name=notmuch \
+        "Email" "New email available in Inbox"
+    '';
+
     home.packages = with pkgs; [
-      aerc
       element-desktop
       weechat
     ];