nixos-config/homes/palo/taskwarrior.nix
2024-09-05 09:21:16 +07:00

107 lines
2 KiB
Nix

{
config,
pkgs,
lib,
...
}:
with lib;
with types;
let
mkMagicMergeOption =
{
description ? "",
example ? { },
default ? { },
apply ? id,
...
}:
mkOption {
inherit
example
description
default
apply
;
type =
with lib.types;
let
valueType =
nullOr (oneOf [
bool
int
float
str
(attrsOf valueType)
(listOf valueType)
])
// {
description = "bool, int, float or str";
emptyValue.value = { };
};
in
valueType;
};
#taskwarrior-tui = pkgs.legacy_2311.taskwarrior-tui;
taskwarrior-tui = pkgs.taskwarrior-tui;
taskwarrior = pkgs.taskwarrior3;
in
{
# bugwarrior (a bit fiddly)
imports = [
{
options.bugwarrior.config = mkMagicMergeOption {
type = attrs;
default = { };
};
config = {
home.file.".config/bugwarrior/bugwarrior.toml".source =
(pkgs.formats.toml { }).generate "bugwarriorrc.toml"
config.bugwarrior.config;
home.packages = [ pkgs.bugwarrior ];
};
}
];
config = mkIf config.gui.enable {
home.packages = [
pkgs.timewarrior
taskwarrior
pkgs.tasksh
pkgs.taskwarrior-hooks
(pkgs.writeShellScriptBin "tsak" ''${taskwarrior}/bin/task "$@"'')
pkgs.vit
taskwarrior-tui
(pkgs.writers.writeBashBin "active" "${taskwarrior-tui}/bin/taskwarrior-tui -r active")
(pkgs.writers.writeBashBin "todo" "${taskwarrior-tui}/bin/taskwarrior-tui -r todo")
(pkgs.writers.writeBashBin "calendar" ''
${taskwarrior}/bin/task calendar
${taskwarrior}/bin/task calendar_report
'')
# todo : belongs to calendar.nix
pkgs.vdirsyncer
pkgs.khal
(pkgs.writers.writeBashBin "kalendar" ''
${pkgs.vdirsyncer}/bin/vdirsyncer sync
${pkgs.khal}/bin/ikhal
'')
];
};
}