2019-04-22 22:40:41 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
with lib;
|
|
|
|
|
let
|
|
|
|
|
cfg = config.niveum.todoist;
|
|
|
|
|
todoist = pkgs.unstable.callPackage <packages/todoist.nix> {};
|
|
|
|
|
in {
|
|
|
|
|
options.niveum.todoist = {
|
|
|
|
|
enable = mkEnableOption "todoist CLI";
|
|
|
|
|
token = mkOption { type = types.strMatching "[0-9a-f]+"; };
|
|
|
|
|
color = mkOption { type = types.bool; default = true; };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
environment.systemPackages = mkIf cfg.enable [
|
2019-07-03 22:12:40 +02:00
|
|
|
(pkgs.writers.writeDashBin "todoist" ''
|
2019-04-22 22:40:41 +02:00
|
|
|
${todoist}/bin/todoist $@
|
|
|
|
|
'')
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
home-manager.users.me.home.file.".todoist.config.json".text = mkIf cfg.enable (builtins.toJSON {
|
|
|
|
|
token = cfg.token;
|
|
|
|
|
color = cfg.color;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
systemd.user.services.todoist-sync = {
|
|
|
|
|
enable = cfg.enable;
|
2019-05-15 18:23:13 +02:00
|
|
|
after = [ "network-online.target" ];
|
2019-04-22 22:40:41 +02:00
|
|
|
startAt = "*:0/5";
|
|
|
|
|
script = ''${todoist}/bin/todoist sync'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|