about summary refs log tree commit diff
path: root/modules/email/default.nix
blob: 165884304463c3d05d8d4013c9fa4e63e534b93a (plain) (blame)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ config, pkgs, lib, secrets, ... }:
{
  services = {
    mbsync.enable = true;
    imapnotify.enable = true;
  };

  programs = {
    mbsync.enable = true;
    msmtp.enable = true;
    neomutt = {
      enable = true;
      sidebar.enable = true;
      vimKeys = true;
      sort = "reverse-date";
    };
  };

  accounts.email = {
    maildirBasePath = "Mail";
    accounts = {
      "manuelpalenzuelamerino@gmail.com" = {
        primary = true;

        realName = "Manuel Palenzuela Merino";
        signature = {
          showSignature = "none";
          text = ''
            Manuel Palenzuela Merino
          '';
        };

        address = "manuelpalenzuelamerino@gmail.com";
        userName = "manuelpalenzuelamerino@gmail.com";

        imap = {
          host = "imap.gmail.com";
          port = 993;
        };

        smtp = {
          host = "smtp.gmail.com";
          port = 587;
        };

        imapnotify = {
          enable = true;
          boxes = [ "Inbox" ];
          onNotifyPost = ''
            ${pkgs.libnotify}/bin/notify-send "New mail arrived."
          '';
        };
        msmtp.enable = true;
        mbsync = {
          enable = true;
          create = "both";
        };
        neomutt = {
          enable = true;
          extraConfig = ''
            set edit_headers = yes  # See the headers when editing
            set charset = UTF-8     # value of $LANG; also fallback for send_charset
            unset use_domain        # because joe@localhost is just embarrassing
            set use_from = yes
          '';
          /*extraConfig = ''
            set imap_user = 'manuelpalenzuelamerino@gmail.com'
            set imap_pass = '${secrets.email."manuelpalenzuelamerino@gmail.com".password}'
            set spoolfile = imaps://imap.gmail.com/INBOX
            set folder = imaps://imap.gmail.com/
            set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
            set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
            set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"

            # ================  SMTP  ====================
            set smtp_url = "smtp://manuelpalenzuelamerino@smtp.gmail.com:587/"
            set smtp_pass = ${secrets.email."manuelpalenzuelamerino@gmail.com".password}
            set ssl_force_tls = yes # Require encrypted connection
          '';*/
        };
        passwordCommand = "${pkgs.coreutils}/bin/echo ${secrets.email."manuelpalenzuelamerino@gmail.com".password}";
      };
    };
  };
}