diff options
| author | Periklis Tsirakidis <periklis.tsirakidis@holidaycheck.com> | 2018-06-04 13:04:16 +0200 |
|---|---|---|
| committer | Periklis Tsirakidis <periklis.tsirakidis@holidaycheck.com> | 2018-06-04 16:25:07 +0200 |
| commit | b85d89a1aee4db1417be1b9aaeb19df736a1364e (patch) | |
| tree | 71fa654a712eee3a1790589283418da209241b78 /modules | |
| parent | 07175b169bf4cab57bb8edffd3df96537dffeb57 (diff) | |
Init offlineimap service
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/services/mail/offlineimap.nix | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/modules/services/mail/offlineimap.nix b/modules/services/mail/offlineimap.nix new file mode 100644 index 0000000..b3cdc2f --- /dev/null +++ b/modules/services/mail/offlineimap.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.offlineimap; +in { + + options.services.offlineimap = { + enable = mkEnableOption "Offlineimap, a software to dispose your mailbox(es) as a local Maildir(s)."; + + package = mkOption { + type = types.package; + default = pkgs.offlineimap; + defaultText = "pkgs.offlineimap"; + description = "Offlineimap derivation to use."; + }; + + path = mkOption { + type = types.listOf types.path; + default = []; + example = literalExample "[ pkgs.pass pkgs.bash pkgs.notmuch ]"; + description = "List of derivations to put in Offlineimap's path."; + }; + + startInterval = mkOption { + type = types.nullOr types.int; + default = null; + example = literalExample "300"; + description = "Optional key to start offlineimap services each N seconds"; + }; + + runQuick = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + Run only quick synchronizations. + Ignore any flag updates on IMAP servers. If a flag on the remote IMAP changes, and we have the message locally, it will be left untouched in a quick run. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = "Additional text to be appended to <filename>offlineimaprc</filename>."; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ cfg.package ]; + environment.etc."offlineimaprc".text = cfg.extraConfig; + launchd.user.agents.offlineimap = { + path = [ cfg.package ]; + command = "offlineimap"; + serviceConfig.KeepAlive = false; + serviceConfig.RunAtLoad = true; + serviceConfig.ProgramArguments = [ "-c" "/etc/offlineimaprc" ] ++ optional (cfg.runQuick != null) "-q"; + serviceConfig.StartInterval = cfg.startInterval; + serviceConfig.StandardErrorPath = "/var/log/offlineimap.log"; + serviceConfig.StandardOutPath = "/var/log/offlineimap.log"; + }; + }; +} |
