aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/email/default.nix
blob: 36dfc953cdb3ed67f34155c619823a2cf53b3490 (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
# email - Mbsync and notmuch mail synchronization
{
  config,
  lib,
  pkgs,
  ...
}:

let
  mailDir = "${config.home.homeDirectory}/.local/mail";
in
{
  options.programs.email = {
    enable = lib.mkEnableOption "Email suite (mbsync + notmuch)";
  };

  config = lib.mkIf config.programs.email.enable {
    home.packages = [
      pkgs.mbsync
      pkgs.notmuch
    ];

    home.sessionVariables = {
      MAILDIR = mailDir;
      NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/notmuchrc";
    };

    xdg.configFile."notmuch/notmuch.config" = {
      text = ''
        [database]
        path=${mailDir}/.notmuch

        [user]
        name=
        address=
        primary_key=

        [new]
        tags=unclassified;new;
        ignore=

        [search]
        exclude_tags=deleted;spam;

        [maildir]
        synchronize_flags=true

        [crypto]
        gpg_path=${pkgs.gnupg}/bin/gpg
      '';
    };
  };
}