fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . taskwarrior-sync ; 8 9in { 10meta . maintainers = with maintainers ; [ minijackson pacien ]; 11 12options . services . taskwarrior-sync = { 13enable = mkEnableOption "Taskwarrior periodic sync" ; 14 15frequency = mkOption { 16type = types . str ; 17default = "*:0/5" ; 18description = '' 19How often to run `taskwarrior sync`. This 20value is passed to the systemd timer configuration as the 21`OnCalendar` option. See 22{manpage}`systemd.time(7)` 23for more information about the format. 24'' ; 25}; 26}; 27 28config = mkIf cfg . enable { 29assertions = [ 30( lib . hm . assertions . assertPlatform "services.taskwarrior-sync" pkgs 31lib . platforms . linux ) 32]; 33 34systemd . user . services . taskwarrior-sync = { 35Unit = { Description = "Taskwarrior sync" ; }; 36Service = { 37CPUSchedulingPolicy = "idle" ; 38IOSchedulingClass = "idle" ; 39ExecStart = " ${ pkgs . taskwarrior } /bin/task synchronize" ; 40}; 41}; 42 43systemd . user . timers . taskwarrior-sync = { 44Unit = { Description = "Taskwarrior periodic sync" ; }; 45Timer = { 46Unit = "taskwarrior-sync.service" ; 47OnCalendar = cfg . frequency ; 48}; 49Install = { WantedBy = [ "timers.target" ]; }; 50}; 51}; 52}