nixos-config/homes/palo/taskwarrior.nix
2024-06-10 15:11:48 +02:00

100 lines
2.5 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;
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;
# todo : before deleting this, put it in logseq
home.packages = [
(pkgs.legacy_2311.python3Packages.bugwarrior.overrideAttrs (old: {
version = "develop";
src = pkgs.fetchFromGitHub {
owner = "ralphbean";
repo = "bugwarrior";
rev = "6554e70c199cc766a2b5e4e4fe22e4e46d64bba1";
sha256 = "sha256-cKhL8FBH7wxCxXrybVRLfCHQTCxursFqtBDl3e1UUXs=";
};
propagatedBuildInputs = old.propagatedBuildInputs ++ [
pkgs.legacy_2311.python3Packages.pydantic
pkgs.legacy_2311.python3Packages.tomli
pkgs.legacy_2311.python3Packages.email-validator
pkgs.legacy_2311.python3Packages.packaging
];
}))
];
};
}];
config = mkIf config.gui.enable {
home.packages = with pkgs;
[
taskwarrior
taskwarrior-tui
timewarrior
tasksh
taskwarrior-hooks
(pkgs.writeShellScriptBin "tsak" ''${pkgs.taskwarrior}/bin/task "$@"'')
vit
(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" ''
${pkgs.taskwarrior}/bin/task calendar
${pkgs.taskwarrior}/bin/task calendar_report
'')
# todo : belongs to calendar.nix
vdirsyncer
khal
(pkgs.writers.writeBashBin "kalendar" ''
${pkgs.vdirsyncer}/bin/vdirsyncer sync
${pkgs.khal}/bin/ikhal
'')
];
};
}