{ pkgs, ... }: let # Nix store paths are world-readable, so accounts.conf (IMAP/SMTP passwords) # stays hand-managed in ~/.config/aerc and out of this module. opener = if pkgs.stdenv.isDarwin then "open" else "xdg-open"; # Renders the markdown body of a composed mail into the text/html half of a # multipart/alternative message (see [multipart-converters] below). mdToHtml = pkgs.writeShellScriptBin "aerc-md2html" '' body=$(${pkgs.cmark-gfm}/bin/cmark-gfm \ --extension autolink \ --extension table \ --extension strikethrough \ --extension tasklist) cat <
$body HTML ''; notify = if pkgs.stdenv.isDarwin then # -activate focuses Ghostty when the banner is clicked. "${pkgs.terminal-notifier}/bin/terminal-notifier" + " -group \"aerc-$AERC_ACCOUNT\"" + " -title \"$AERC_ACCOUNT/$AERC_FOLDER\"" + " -subtitle \"$AERC_FROM_NAME\"" + " -message \"$AERC_SUBJECT\"" + " -activate com.mitchellh.ghostty" else "${pkgs.libnotify}/bin/notify-send" + " \"[$AERC_ACCOUNT/$AERC_FOLDER] $AERC_FROM_NAME\"" + " \"$AERC_SUBJECT\""; in { home.file = { ".config/aerc/aerc.conf".text = '' [general] default-save-path=~/Downloads pgp-provider=auto default-menu-cmd=fzf --reverse --prompt='> ' [ui] styleset-name=tokyonight mouse-enabled=true threading-enabled=true fuzzy-complete=true keyhint=true keyhint-delay=300ms sidebar-width=24 index-columns=flags:4,name<20%,subject,date>= timestamp-format=2006-01-02 15:04 this-day-time-format=15:04 this-week-time-format=Mon 15:04 this-year-time-format=02 Jan empty-message=(no messages) empty-dirlist=(no folders) [statusline] column-left=[{{.Account}}] {{.StatusInfo}} column-center={{.PendingKeys}} column-right={{.TrayInfo}} [viewer] pager=less -Rc alternatives=text/plain,text/html show-headers=false header-layout=From|To,Cc|Bcc,Date,Subject parse-http-links=true [compose] editor=nvim -c 'set ft=mail' -c 'set textwidth=72' -c 'set nolist' header-layout=To|From,Subject focus-body=true empty-subject-warning=true no-attachment-warning=^[^>]*attach(ed|ment) [multipart-converters] text/html=${mdToHtml}/bin/aerc-md2html [hooks] mail-received=${notify} [filters] text/plain=colorize text/calendar=calendar message/delivery-status=colorize message/rfc822=colorize text/html=! html .headers=colorize [openers] x-scheme-handler/http*=${opener} {} x-scheme-handler/mailto=${opener} {} text/html=${opener} {} application/pdf=${opener} {} image/*=${opener} {} ''; ".config/aerc/binds.conf".text = '' # Part/field navigation is bound twice: C-j/C-k as aerc ships them, plus # ]p/[p and Alt-j/Alt-k (right Option = Alt, see modules/home/ghostty.nix) # which keep working if vim-tmux-navigator's tmux side is ever installed, # since it claims C-h/j/k/l for any pane that is not running vim.