summaryrefslogtreecommitdiff
path: root/modules/mail/default.nix
blob: e57fba53f4106ae545a793a6d2746d407b420ef0 (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
{ config, pkgs, ... }:
let
  mbsyncConf = ./mbsyncrc;
in
{
  environment.systemPackages = with pkgs; [
    isync
    msmtp
    neomutt
    notmuch
    pass
    w3m
  ];

  sops.secrets = {
    "mail/oxapentane.com" = {
      owner = config.users.users.grue.name;
    };
    "mail/shipunov.xyz" = {
      owner = config.users.users.grue.name;
    };
    "mail/dvb.solutions" = {
      owner = config.users.users.grue.name;
    };
  };

  programs.msmtp = {
    enable = true;
    setSendmail = true;
  };
  systemd.user = {

    services.mbsync = {
      enable = true;
      after = [ "graphical.target" "network-online.target" ];
      script = ''
        ${pkgs.isync}/bin/mbsync -a --config=${mbsyncConf}
      '';
      serviceConfig = {
        Type = "oneshot";
      };
    };

    timers.mbsync = {
      enable = true;
      wantedBy = [ "timers.target" ];
      timerConfig = {
        Unit = "mbsync.service";
        OnUnitInactiveSec = "11m";
        Persistent = true;
      };
    };

  };
}