40 lines
925 B
Nix
40 lines
925 B
Nix
|
{ config, pkgs, lib, ... }:
|
||
|
|
||
|
with lib;
|
||
|
|
||
|
let
|
||
|
|
||
|
cfg = config.programs.custom.taskwarrior;
|
||
|
|
||
|
taskNextWeek = pkgs.writeShellScriptBin "taskweek" /* sh */ ''
|
||
|
${pkgs.taskwarrior}/bin/task \
|
||
|
export \
|
||
|
status:pending and \( due.before:6days \) \
|
||
|
| ${pkgs.jq}/bin/jq '[.[] | { Day: .due, ID: .id, Description: .description } ] | sort_by(.Day)' \
|
||
|
| ${pkgs.miller}/bin/mlr --ijson --opprint put "\$Day = strftime(strptime(\$Day,\"%Y%m%dT%H%M%SZ\")$(date +%z)00,\"%A\")"
|
||
|
'';
|
||
|
|
||
|
tsak = pkgs.writeShellScriptBin "tsak" /* sh */ ''
|
||
|
${pkgs.taskwarrior}/bin/task "$@"
|
||
|
'';
|
||
|
|
||
|
in {
|
||
|
|
||
|
options.programs.custom.taskwarrior.enable = mkEnableOption "Enable Taskwarrior services";
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
|
||
|
environment.systemPackages = with pkgs; [
|
||
|
taskwarrior
|
||
|
timewarrior
|
||
|
tasksh
|
||
|
taskNextWeek
|
||
|
tsak
|
||
|
|
||
|
python # needed for hooks
|
||
|
];
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|