174 lines
5.4 KiB
Nix
174 lines
5.4 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
nixosConfig,
|
|
...
|
|
}: let
|
|
# Data storage location for taskwarrior
|
|
dataLocation = "/home/malte/Tasks";
|
|
# A usable (with dateutil) python interpreter for timewarrior's totals.py extension
|
|
pythonWithLibs = pkgs.python3.withPackages (ps: [ps.dateutil]);
|
|
# This is a patched version of the upstream `totals.py` script
|
|
# so sum up timewarrior stats
|
|
# This just patches the first line to use a python interpreter that has
|
|
# `dateutil` available!
|
|
timewarriorExtensions = let
|
|
hashes = (builtins.import ../../hashes.nix).timewarrior;
|
|
in
|
|
pkgs.stdenvNoCC.mkDerivation {
|
|
name = "timewarrior-totals";
|
|
inherit (hashes) version;
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "GothenburgBitFactory";
|
|
repo = "timewarrior";
|
|
rev = hashes.version;
|
|
inherit (hashes) hash;
|
|
};
|
|
buildInputs = [pkgs.coreutils];
|
|
propagatedBuildInputs = [pythonWithLibs];
|
|
phases = ["unpackPhase" "patchPhase" "installPhase"];
|
|
patchPhase = ''
|
|
sed -i 's|^#!/usr/bin/env python3$|#!${pythonWithLibs}/bin/python3|' \
|
|
ext/totals.py \
|
|
ext/on-modify.timewarrior
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp ext/totals.py ext/on-modify.timewarrior $out/
|
|
'';
|
|
};
|
|
# Color scheme used for taskwarrior
|
|
taskwarriorColors = pkgs.writeText "colors.rc" ''
|
|
# General decoration
|
|
color.label=white
|
|
color.label.sort=bold
|
|
color.alternate=
|
|
color.footnote=green
|
|
color.error=red
|
|
# Status
|
|
color.completed=gray8
|
|
color.deleted=rgb335
|
|
color.blocked=gray12
|
|
color.blocking=blue
|
|
color.active=black on cyan
|
|
color.scheduled=bold black on blue
|
|
# Tags
|
|
color.tag.irgendwann=gray16
|
|
color.tag.extern=gray20
|
|
color.tag.github=magenta
|
|
color.tag.unsorted=black on yellow
|
|
# Projects
|
|
color.project.nixos=green
|
|
color.project.unsorted=black on yellow
|
|
# Priority
|
|
color.uda.priority.H=bold yellow
|
|
color.uda.priority.M=yellow
|
|
color.uda.priority.L=gray20
|
|
# Due
|
|
color.due=red
|
|
color.due.today=bold red
|
|
color.overdue=bold black on red
|
|
# Report: summary
|
|
color.summary.background=on yellow
|
|
color.summary.bar=color0 on cyan
|
|
# Report: burndown
|
|
color.burndown.done=on cyan
|
|
color.burndown.pending=on red
|
|
color.burndown.started=on yellow
|
|
# Report: history
|
|
color.history.add=black on yellow
|
|
color.history.delete=black on red
|
|
color.history.done=black on cyan
|
|
# Command: undo
|
|
color.undo.after=cyan
|
|
color.undo.before=red
|
|
# Command: calendar
|
|
color.calendar.due=black on red
|
|
color.calendar.due.today=black on red
|
|
color.calendar.holiday=green
|
|
color.calendar.overdue=black on magenta
|
|
color.calendar.today=black on cyan
|
|
color.calendar.weekend=yellow
|
|
color.calendar.weeknumber=gray6
|
|
color.calendar.scheduled=black on white
|
|
# Command: sync
|
|
color.sync.added=cyan
|
|
color.sync.changed=yellow
|
|
color.sync.rejected=red
|
|
# Remove some defaults
|
|
color.tagged=
|
|
color.tag.next=
|
|
color.recurring=
|
|
'';
|
|
cfg = config.settings.taskwarrior;
|
|
in {
|
|
options.settings.taskwarrior.enable = lib.mkEnableOption "taskwarrior related stuff";
|
|
config = lib.mkIf cfg.enable {
|
|
# Install timewarrior aswell!
|
|
# Timewarrior hook needs Python3.. or a patch.. to lazy for the latter
|
|
home.packages = with pkgs; [timewarrior python3];
|
|
|
|
programs.taskwarrior = {
|
|
inherit dataLocation;
|
|
enable = true;
|
|
colorTheme = taskwarriorColors;
|
|
config = {
|
|
include = "${pkgs.taskwarrior}/share/doc/task/rc/holidays.de-DE.rc";
|
|
urgency.user.tag = {
|
|
irgendwann.coefficient = "-100.0";
|
|
extern.coefficient = "-50.0";
|
|
};
|
|
dateformat = "D.M.Y H:N";
|
|
fontunderline = false;
|
|
rule.precedence.color = "rule.precedence.color=deleted,completed,active,tag.unsorted,project.unsorted,keyword.,tag.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,uda.";
|
|
weekstart = "Monday";
|
|
calendar.holidays = "sparse";
|
|
|
|
uda.reviewed = {
|
|
type = "date";
|
|
label = "Reviewed";
|
|
};
|
|
report._reviewed = {
|
|
description = "Tasksh review report. Adjust the filter to your needs.";
|
|
columns = "uuid";
|
|
sort = "reviewed+,modified+";
|
|
filter = "( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING )";
|
|
};
|
|
taskd = {
|
|
certificate = nixosConfig.sops.secrets.taskserver-certificate.path;
|
|
key = nixosConfig.sops.secrets.taskserver-private-key.path;
|
|
ca = nixosConfig.sops.secrets.taskserver-ca-certificate.path;
|
|
server = "inthe.am:53589";
|
|
credentials = "inthe_am/malte.tammena/63b57bb7-f23e-440c-bd9f-658efa1e194d";
|
|
trust = "strict";
|
|
};
|
|
context = {
|
|
work = {
|
|
read = "+work";
|
|
write = "+work";
|
|
};
|
|
uni = {
|
|
read = "+uni";
|
|
write = "+uni";
|
|
};
|
|
home = {
|
|
read = "-uni -work";
|
|
write = "";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
services.taskwarrior-sync = {
|
|
enable = true;
|
|
};
|
|
|
|
home.file.".timewarrior/extensions/totals.py".source = "${timewarriorExtensions}/totals.py";
|
|
home.file."${dataLocation}/hooks/on-modify-timewarrior" = {
|
|
source = "${timewarriorExtensions}/on-modify.timewarrior";
|
|
executable = true;
|
|
};
|
|
};
|
|
}
|