aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/modules/workstation/mail/core/default.nix
blob: 58d372ffa1228dcbef9b3aaef77b7b54ca532818 (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
{ pkgs, config, ... } @ args:

let cfg = config.libkookie.workstation.mail;
in
{
  # Might want to run mbsync manually
  environment.systemPackages = with pkgs; [ isync ];

  # Setup user to fetch mail
  users.users.mail-user = {
    createHome = true;
    inherit (cfg.access) group;
    home = "/var/lib/mail";
  };

  systemd.services.isync = (import ./isync.nix) args;
  
  systemd.timers.isync = {
    timerConfig.Unit = "isync.service";
    timerConfig.OnCalendar = "*:0/5";
    timerConfig.Persistent = "true";
    after = [ "network-online.target" ];
    wantedBy = [ "timers.target" ];
  };

  # FIXME: this doesn't work and has never worked
  # This sudoers rule allows anyone in the wheel group to run this
  # particular command without a password. Make sure that 'startISync'
  # is present in a path (environment.systemPackages above)!
  # security.sudo.extraRules = [
  #   { commands = [ { command = "${startISync}/bin/start-isync";
  #                    options = [ "NOPASSWD" ]; } ];
  #     groups = [ "wheel" ];  }
  # ];
}