nixos-config/modules/programs/taskwarrior.nix
Ingolf Wagner 4e199799de
reformat
2020-01-24 23:20:10 +13:00

60 lines
1.4 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.custom.taskwarrior;
unstable = import <nixpkgs-unstable> { };
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
unstable.vit
python # needed for hooks
taskwarrior-hooks
# bugwarrior
(let
mypython = let
packageOverrides = self: super: {
bugwarrior = super.bugwarrior.overridePythonAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs
++ [ super.setuptools ];
});
};
in pkgs.python3.override { inherit packageOverrides; };
in mypython.pkgs.bugwarrior)
];
};
}