1 { pkgs, lib, config, ... }:
4 services.arbtt-capture = {
7 "PATH=${lib.makeBinPath [
11 ExecStart = pkgs.writeShellScript "arbtt-capture-start" ''
13 LOG=${config.xdg.dataHome}/arbtt/$(date +%Y).capture
14 ln -snf "$LOG" "${config.xdg.dataHome}/arbtt/capture.log"
15 exec ${pkgs.haskellPackages.arbtt}/bin/arbtt-capture --logfile="$LOG"
20 Description = "Arbtt capture service";
21 PartOf = [ "graphical-session.target" ];
23 "graphical-session-pre.target"
27 WantedBy = [ "graphical-session.target" ];
32 home.activation.linkDotfiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
33 ln -sfn ${config.xdg.dataHome}/arbtt $HOME/.arbtt
35 xdg.dataFile."arbtt/categorize.cfg".text = lib.mkDefault ''
36 -- Simple rule that just tags the current program
37 $idle > 30 ==> tag inactive,
38 tag Program:$current.program,
41 pkgs.haskellPackages.arbtt
42 (pkgs.writeShellScriptBin "arbtt-stats-for" ''
48 today=$(date +"%Y-%m-%d")
50 arbtt-stats -m 0.1 --filter='$date>='$today "$@"
53 today=$(date +"%Y-%m-%d")
54 today=$(date -dlast-monday +%Y-%m-%d)
56 arbtt-stats -m 0.1 --filter='$date>='$today "$@"
59 today=$(date +"%Y-%m-01")
61 arbtt-stats -m 0.01 --filter='$date>='$today "$@"
64 startday=$(date --date="$(date +%Y-%m-15) -1 month" +'%Y-%m-01')
65 endday=$(date --date="$(date +%Y-%m-01) -1 day" +'%Y-%m-%d')
66 echo "$startday to $endday"
67 arbtt-stats -m 0.01 --filter='$date>='$startday' && $date<='$(date +%Y-%m-01) "$@"
70 startday=$(date --date="$(date +%Y-%m-%d) -1 day" +'%Y-%m-%d')
71 endday=$(date +%Y-%m-%d)
73 arbtt-stats -m 0.1 --filter='$date>='$startday' && $date<='$endday "$@"
77 endday=$(date --date="$2 +1 day" +'%Y-%m-%d')
79 arbtt-stats -m 0.1 --filter='$date>='$startday' && $date<='$endday "$@"
82 echo "Usage: arbtt [OPTIONS...]"