diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 0af6963a..59f1726d 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1137,6 +1137,14 @@ in
A new module is available: 'programs.broot'.
'';
}
+
+ {
+ time = "2019-07-17T19:30:29+00:00";
+ condition = hostPlatform.isLinux;
+ message = ''
+ A new module is available: 'services.taskwarrior-sync'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 2a3549d1..d5efe2d1 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -124,6 +124,7 @@ let
(loadModule ./services/syncthing.nix { })
(loadModule ./services/taffybar.nix { })
(loadModule ./services/tahoe-lafs.nix { })
+ (loadModule ./services/taskwarrior-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/udiskie.nix { })
(loadModule ./services/unclutter.nix { })
(loadModule ./services/window-managers/awesome.nix { })
diff --git a/modules/services/taskwarrior-sync.nix b/modules/services/taskwarrior-sync.nix
new file mode 100644
index 00000000..f92f532b
--- /dev/null
+++ b/modules/services/taskwarrior-sync.nix
@@ -0,0 +1,59 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.taskwarrior-sync;
+
+in
+
+{
+ meta.maintainers = with maintainers; [ minijackson pacien ];
+
+ options.services.taskwarrior-sync = {
+ enable = mkEnableOption "Taskwarrior periodic sync";
+
+ frequency = mkOption {
+ type = types.str;
+ default = "*:0/5";
+ description = ''
+ How often to run taskwarrior sync. This
+ value is passed to the systemd timer configuration as the
+ OnCalendar option. See
+
+ systemd.time
+ 7
+
+ for more information about the format.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.user.services.taskwarrior-sync = {
+ Unit = {
+ Description = "Taskwarrior sync";
+ PartOf = [ "network-online.target" ];
+ };
+ Service = {
+ CPUSchedulingPolicy = "idle";
+ IOSchedulingClass = "idle";
+ ExecStart = "${pkgs.taskwarrior}/bin/task synchronize";
+ };
+ };
+
+ systemd.user.timers.taskwarrior-sync = {
+ Unit = {
+ Description = "Taskwarrior periodic sync";
+ };
+ Timer = {
+ Unit = "taskwarrior-sync.service";
+ OnCalendar = cfg.frequency;
+ };
+ Install = {
+ WantedBy = [ "timers.target" ];
+ };
+ };
+ };
+}