aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/aerc/default.nix
blob: 5b4ce78389a66a420b8a0dca78a95f803e447770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# aerc - Terminal email client
{
  config,
  lib,
  ...
}:

{
  imports = [ ./assertions.nix ];

  config = lib.mkIf config.programs.aerc.enable {
    programs.aerc = {
      extraConfig = {
        general = {
          unsafe-accounts-conf = false;
          default-save-path = "${config.home.homeDirectory}/Downloads";
          use-terminal-pinentry = false;
        };

        ui = {
          index-columns = "flags:4,name<32%,subject,date>=";
          column-name = "{{with index .From 0}}{{.Address}}{{if .Name}} ({{.Name}}){{end}}{{end}}";
          timestamp-format = "2006-01-02 15:04";
          this-day-time-format = "15:04";
          this-week-time-format = "Mon 15:04";
          sidebar-width = 24;
        };

        viewer = {
          pager = lib.getExe config.programs.less.package;
          show-headers = true;
        };

        filters = ''
          text/plain = fold -w 100 -s
          text/html = fold -w 100 -s
          text/* = fold -w 100 -s
          message/delivery-status = fold -w 100 -s
        '';

        hooks = {
          mail-added = "aerc-sync-mail \"$AERC_ACCOUNT\"";
          mail-deleted = "aerc-sync-mail \"$AERC_ACCOUNT\"";
          flag-changed = "aerc-sync-mail \"$AERC_ACCOUNT\"";
        };
      };
    };

    home.file.".config/aerc/notmuch-query-map".text = ''
      Inbox=tag:inbox and not tag:deleted
      Unread=tag:unread and not tag:deleted
      Flagged=tag:flagged and not tag:deleted
      Sent=folder:sent or folder:Sent or folder:"[Gmail]/Sent Mail"
      Archive=not tag:inbox and not tag:deleted
      All=*
    '';
  };
}