{ config, lib, pkgs, ... }: let cfg = config.soispha.programs.timewarrior; track_timewarrior = pkgs.stdenv.mkDerivation { name = "track_timewarrior.taskwarrior-hook"; nativeBuildInputs = [ pkgs.makeWrapper ]; buildInputs = [ pkgs.timewarrior pkgs.taskwarrior # TODO: Use a `taskw` package, that actually supports newer python variants <2024-07-13> (pkgs.python311.withPackages (pythonPackages: with pythonPackages; [ taskw ])) ]; dontUnpack = true; installPhase = '' install -Dm755 ${./taskwarirror_hooks/on-modify_track-timewarrior.py} $out/bin/bin wrapProgram $out/bin/bin \ --prefix PATH : ${lib.makeBinPath [pkgs.taskwarrior pkgs.timewarrior]} ''; meta.mainProgram = "bin"; }; track_total_active_time = pkgs.stdenv.mkDerivation { name = "track_total_active_time.taskwarrior-hook"; nativeBuildInputs = [ pkgs.makeWrapper ]; buildInputs = [ pkgs.taskwarrior # TODO: Use a `taskw` package, that actually supports newer python variants <2024-07-13> (pkgs.python311.withPackages (pythonPackages: with pythonPackages; [ taskw ])) ]; dontUnpack = true; installPhase = '' install -Dm755 ${./taskwarirror_hooks/on-modify_track-total-active-time.py} $out/bin/bin wrapProgram $out/bin/bin \ --prefix PATH : ${lib.makeBinPath [pkgs.taskwarrior]} ''; meta.mainProgram = "bin"; }; in { options.soispha.programs.timewarrior = { enable = lib.mkEnableOption "timewarrior"; }; config = lib.mkIf cfg.enable { soispha.programs.taskwarrior = { hooks = { track-timewarrior = { mode = "on-modify"; executable = track_timewarrior; }; track-total-active-time = { mode = "on-modify"; executable = track_total_active_time; }; }; }; home-manager.users.soispha = { home.packages = [ pkgs.timewarrior ]; xdg.configFile."timewarrior/timewarrior.cfg".text = '' # source: https://github.com/arcticicestudio/igloo #+----+ #+ UI + #+----+ import ${./nord.theme} color = true #+---------+ #+ Reports + #+---------+ define reports: day: lines = 10 month = true week = true ''; }; }; }