aboutsummaryrefslogtreecommitdiff
path: root/home/profiles/messaging
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-09-09 17:49:03 +0900
committersefidel <contact@sefidel.net>2022-09-09 21:32:31 +0900
commit9e6145c031b47fc37398b80dec1b4dfc0cfb5183 (patch)
treef27e3c50a0c25223931e7057616e456432007de9 /home/profiles/messaging
parent9e311725d4f6c68284e3999c01735ebe3665a14d (diff)
downloadnixrc-9e6145c031b47fc37398b80dec1b4dfc0cfb5183.zip
milestone: darwin!
feat(darwin/kompakt)!: support darwin chore: reformat feat(home/o32): manage neovim feat(home/development): fix haskell lsp version mismatch feat(darwin/*): stabilise
Diffstat (limited to 'home/profiles/messaging')
-rw-r--r--home/profiles/messaging/default.nix491
1 files changed, 247 insertions, 244 deletions
diff --git a/home/profiles/messaging/default.nix b/home/profiles/messaging/default.nix
index 6d34ff5..3d8a437 100644
--- a/home/profiles/messaging/default.nix
+++ b/home/profiles/messaging/default.nix
@@ -12,8 +12,8 @@ let
key = lib.elemAt x' 1;
action = lib.last x';
});
- mailPass = x: "${pkgs.pass}/bin/pass show emails/${x}";
- mbsyncCmd = "${config.programs.mbsync.package}/bin/mbsync";
+ mailPass = x: if pkgs.stdenv.isLinux then "${pkgs.pass}/bin/pass show emails/${x}" else "";
+ mbsyncCmd = if pkgs.stdenv.isLinux then "${config.programs.mbsync.package}/bin/mbsync" else "";
in
{
imports = [ ../../modules/programs/nixpkgs ];
@@ -23,259 +23,260 @@ in
"A profile that enables the system to communicate via internet.";
};
- config = lib.mkIf cfg.enable {
- accounts.email = {
- maildirBasePath = "${config.home.homeDirectory}/mail";
+ config = lib.mkIf cfg.enable (lib.mkMerge [
+ (lib.mkIf pkgs.stdenv.isLinux {
+ accounts.email = {
+ maildirBasePath = "${config.home.homeDirectory}/mail";
- accounts.zach = {
- address = poorObfuscation "zachel.io" "zach";
- gpg = {
- key = "346833414516C852FFB238E19F734565641C2F14";
- signByDefault = true;
- };
+ accounts.zach = {
+ address = poorObfuscation "zachel.io" "zach";
+ gpg = {
+ key = "346833414516C852FFB238E19F734565641C2F14";
+ signByDefault = true;
+ };
- imap.host = "imap.migadu.com";
- imap.tls.enable = true;
- smtp.host = "smtp.migadu.com";
- smtp.tls.enable = true;
+ imap.host = "imap.migadu.com";
+ imap.tls.enable = true;
+ smtp.host = "smtp.migadu.com";
+ smtp.tls.enable = true;
- mbsync = {
- enable = true;
- create = "maildir";
- remove = "none";
- expunge = "both";
+ mbsync = {
+ enable = true;
+ create = "maildir";
+ remove = "none";
+ expunge = "both";
- extraConfig.account.SSLType = "IMAPS";
- extraConfig.account.SSLVersions = "TLSv1.2";
- };
+ extraConfig.account.SSLType = "IMAPS";
+ extraConfig.account.SSLVersions = "TLSv1.2";
+ };
- msmtp.enable = true;
- notmuch.enable = true;
- neomutt.enable = true;
- neomutt.mailboxName = "zach";
- neomutt.extraMailboxes = [
- "Archive"
- "Drafts"
- "Junk"
- "Sent"
- "Trash"
- ];
+ msmtp.enable = true;
+ notmuch.enable = true;
+ neomutt.enable = true;
+ neomutt.mailboxName = "zach";
+ neomutt.extraMailboxes = [
+ "Archive"
+ "Drafts"
+ "Junk"
+ "Sent"
+ "Trash"
+ ];
- imapnotify = {
- enable = true;
- boxes = [ "Inbox" ];
- onNotify = pkgs.writeShellScript "imap-on-notify" ''
- ${mbsyncCmd} zach
- ${pkgs.notmuch}/bin/notmuch new
- '';
+ imapnotify = {
+ enable = true;
+ boxes = [ "Inbox" ];
+ onNotify = pkgs.writeShellScript "imap-on-notify" ''
+ ${mbsyncCmd} zach
+ ${pkgs.notmuch}/bin/notmuch new
+ '';
+ };
+
+ primary = true;
+ realName = "zachel";
+ userName = poorObfuscation "zachel.io" "zach";
+ passwordCommand = mailPass "zach";
};
+ };
- primary = true;
- realName = "zachel";
- userName = poorObfuscation "zachel.io" "zach";
- passwordCommand = mailPass "zach";
+ programs.abook.enable = true;
+ programs.mbsync.enable = true;
+ programs.msmtp.enable = true;
+ programs.notmuch = {
+ enable = true;
+ hooks.preNew = "${mbsyncCmd} --all";
};
- };
- programs.abook.enable = true;
- programs.mbsync.enable = true;
- programs.msmtp.enable = true;
- programs.notmuch = {
- enable = true;
- hooks.preNew = "${mbsyncCmd} --all";
- };
+ programs.neomutt = {
+ enable = true;
+ sidebar.enable = true;
+ sidebar.format = "%D%?F? [%F]?%* %?N?*N/?%S";
- programs.neomutt = {
- enable = true;
- sidebar.enable = true;
- sidebar.format = "%D%?F? [%F]?%* %?N?*N/?%S";
+ sort = "reverse-threads";
- sort = "reverse-threads";
+ settings = {
+ date_format = ''"%y/%m/%d %I:%M%p"'';
+ index_format = ''"%4C %Z %?X?A& ? %D %-15.15L (%-4.4c) %s"'';
+ 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";
- settings = {
- date_format = ''"%y/%m/%d %I:%M%p"'';
- index_format = ''"%4C %Z %?X?A& ? %D %-15.15L (%-4.4c) %s"'';
- 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";
+ # edit headers in editor
+ autoedit = "yes";
+ edit_headers = "yes";
+ };
- # edit headers in editor
- autoedit = "yes";
- edit_headers = "yes";
- };
+ binds = mapKeys [
+ "index,pager i noop"
+ "index,pager g noop"
+ "index \\Cf noop"
+ "index j next-entry"
+ "index k previous-entry"
+ "attach <return> view-mailcap"
+ "attach l view-mailcap"
+ "editor <space> noop"
+ "index G last-entry"
+ "index gg first-entry"
+ "pager,attach h exit"
+ "pager j next-line"
+ "pager k previous-line"
+ "pager l view-attachments"
+ "index D delete-message"
+ "index U undelete-message"
+ "index L limit"
+ "index h noop"
+ "index l display-message"
+ "index,query <space> tag-entry"
+ "browser h goto-parent"
+ "index,pager H view-raw-message"
+ "browser l select-entry"
+ "pager,browser gg top-page"
+ "pager,browser G bottom-page"
+ "index,pager,browser d half-down"
+ "index,pager,browser u half-up"
+ "index,pager S sync-mailbox"
+ "index,pager R group-reply"
+ "index \\031 previous-undeleted" # Mouse wheel
+ "index \\005 next-undeleted" # Mouse wheel
+ "pager \\031 previous-line" # Mouse wheel
+ "pager \\005 next-line" # Mouse wheel
+ "editor <Tab> complete-query"
- binds = mapKeys [
- "index,pager i noop"
- "index,pager g noop"
- "index \\Cf noop"
- "index j next-entry"
- "index k previous-entry"
- "attach <return> view-mailcap"
- "attach l view-mailcap"
- "editor <space> noop"
- "index G last-entry"
- "index gg first-entry"
- "pager,attach h exit"
- "pager j next-line"
- "pager k previous-line"
- "pager l view-attachments"
- "index D delete-message"
- "index U undelete-message"
- "index L limit"
- "index h noop"
- "index l display-message"
- "index,query <space> tag-entry"
- "browser h goto-parent"
- "index,pager H view-raw-message"
- "browser l select-entry"
- "pager,browser gg top-page"
- "pager,browser G bottom-page"
- "index,pager,browser d half-down"
- "index,pager,browser u half-up"
- "index,pager S sync-mailbox"
- "index,pager R group-reply"
- "index \\031 previous-undeleted" # Mouse wheel
- "index \\005 next-undeleted" # Mouse wheel
- "pager \\031 previous-line" # Mouse wheel
- "pager \\005 next-line" # Mouse wheel
- "editor <Tab> complete-query"
+ # Pager stuff
+ "index,pager B sidebar-toggle-visible"
+ ];
+ macros = mapKeys [
+ "index,pager \\Ck <sidebar-prev><sidebar-open>"
+ "index,pager \\Cj <sidebar-next><sidebar-open>"
+ "index,pager \\Cp <sidebar-prev-new><sidebar-open>"
+ "index,pager \\Cn <sidebar-next-new><sidebar-open>"
+ "index,pager \\Cb <pipe-message>urlscan<Enter>"
+ "attach,compose \\Cb <pipe-entry>urlscan<Enter>"
+ ];
- # Pager stuff
- "index,pager B sidebar-toggle-visible"
- ];
- macros = mapKeys [
- "index,pager \\Ck <sidebar-prev><sidebar-open>"
- "index,pager \\Cj <sidebar-next><sidebar-open>"
- "index,pager \\Cp <sidebar-prev-new><sidebar-open>"
- "index,pager \\Cn <sidebar-next-new><sidebar-open>"
- "index,pager \\Cb <pipe-message>urlscan<Enter>"
- "attach,compose \\Cb <pipe-entry>urlscan<Enter>"
- ];
+ # TODO: Re-theme this after nightlamp -> limestone theme
+ extraConfig = ''
+ # Default index colors:
+ color index yellow default '.*'
+ color index_author red default '.*'
+ color index_number blue default
+ color index_subject cyan default '.*'
- # TODO: Re-theme this after nightlamp -> limestone theme
- 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"
- # 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"
- # 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
- # 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<>\"]"
+ '';
+ };
- # 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" "Sync completed"
'';
- };
-
- programs.notmuch.hooks.postNew = ''
- ${pkgs.libnotify}/bin/notify-send --icon=mail-unread --app-name=notmuch \
- "Email" "Sync completed"
- '';
- services.imapnotify.enable = true;
+ services.imapnotify.enable = true;
- # Sync emails on initial login
- systemd.user.services.mbsync-oneshot = {
- Unit = {
- Description = "mbsync oneshot synchronisation";
- };
- Service = {
- Type = "oneshot";
- ExecStart = "${mbsyncCmd} --all";
- RemainAfterExit = true;
+ # Sync emails on initial login
+ systemd.user.services.mbsync-oneshot = {
+ Unit = {
+ Description = "mbsync oneshot synchronisation";
+ };
+ Service = {
+ Type = "oneshot";
+ ExecStart = "${mbsyncCmd} --all";
+ RemainAfterExit = true;
+ };
+ Install.WantedBy = [ "default.target" ];
};
- Install.WantedBy = [ "default.target" ];
- };
- home.file.".mailcap".text =
- let
- setsid = "${pkgs.util-linux}/bin/setsid";
- openfile = "${pkgs.writeShellScript "openfile" ''
+ home.file.".mailcap".text =
+ let
+ setsid = "${pkgs.util-linux}/bin/setsid";
+ openfile = "${pkgs.writeShellScript "openfile" ''
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
tempdir="''${TMPDIR:-$(mktemp -d)}"
file="$tempdir/$(basename "$1")"
@@ -285,23 +286,25 @@ in
$opener "$file" >/dev/null 2>&1
find "''${tempdir:?}" -mtime +1 -type f -delete
''}";
- in
- ''
- ${lib.optionalString false "text/html; ${pkgs.w3m}/bin/w3m -dump -T text/html -I %{charset} -O utf-8 %s; copiousoutut; description=HTML Text; nametemplate=%s.html"}
- text/plain; $EDITOR %s ;
- ${lib.optionalString true "text/html; ${openfile} %s ; nametemplate=%s.html"}
- text/html; ${pkgs.lynx}/bin/lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
- image/*; ${openfile} %s ;
- application/pdf; ${openfile} %s ;
- # application/pgp-encrypted; gpg -d '%s'; copiousoutput;
- '';
-
- home.packages = with pkgs; [
- urlscan
- ispell
+ in
+ ''
+ ${lib.optionalString false "text/html; ${pkgs.w3m}/bin/w3m -dump -T text/html -I %{charset} -O utf-8 %s; copiousoutut; description=HTML Text; nametemplate=%s.html"}
+ text/plain; $EDITOR %s ;
+ ${lib.optionalString true "text/html; ${openfile} %s ; nametemplate=%s.html"}
+ text/html; ${pkgs.lynx}/bin/lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
+ image/*; ${openfile} %s ;
+ application/pdf; ${openfile} %s ;
+ # application/pgp-encrypted; gpg -d '%s'; copiousoutput;
+ '';
+ })
+ {
+ home.packages = with pkgs; [
+ urlscan
+ ispell
- element-desktop
- weechat
- ];
- };
+ element-desktop
+ weechat
+ ];
+ }
+ ]);
}