{ config, lib, pkgs, ... }: let cfg = config.soispha.programs.timewarrior; track_timewarrior = pkgs.stdenv.mkDerivation { name = "track-timewarrior"; nativeBuildInputs = [ pkgs.makeWrapper ]; buildInputs = [ pkgs.timewarrior pkgs.taskwarrior3 pkgs.python3 ]; dontUnpack = true; installPhase = '' install -Dm755 ${./taskwarrior_hooks/on-modify.track-timewarrior.py} $out/bin/track-timewarrior wrapProgram $out/bin/track-timewarrior \ --set PATH ${lib.makeBinPath [pkgs.taskwarrior3 pkgs.timewarrior]} ''; meta.mainProgram = "track-timewarrior"; }; track_total_active_time = pkgs.stdenv.mkDerivation { name = "track-total-active-time"; nativeBuildInputs = [ pkgs.makeWrapper ]; buildInputs = [ pkgs.taskwarrior3 pkgs.python3 ]; dontUnpack = true; installPhase = '' install -Dm755 ${./taskwarrior_hooks/on-modify.track-total-active-time.py} $out/bin/track-total-active-time wrapProgram $out/bin/track-total-active-time \ --set PATH ${lib.makeBinPath [pkgs.taskwarrior3]} ''; meta.mainProgram = "track-total-active-time"; }; 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 ''; }; }; }