From 881eae68948cefe33fbb27dfacc34ab5c1152f7c Mon Sep 17 00:00:00 2001 From: caandt Date: Tue, 31 Dec 2024 21:25:02 -0500 Subject: [PATCH] activitywatch --- hosts/hebesu/users/ahnwuoa/default.nix | 1 + hosts/hyuganatsu/users/ahnwuoa/default.nix | 13 +-------- user/activitywatch.nix | 25 ++++++++++++++++ user/default.nix | 1 + user/options.nix | 34 ++++++++++++---------- 5 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 user/activitywatch.nix diff --git a/hosts/hebesu/users/ahnwuoa/default.nix b/hosts/hebesu/users/ahnwuoa/default.nix index 8ac0829..26a3692 100644 --- a/hosts/hebesu/users/ahnwuoa/default.nix +++ b/hosts/hebesu/users/ahnwuoa/default.nix @@ -9,4 +9,5 @@ home.username = "ahnwuoa"; xresources.properties."Xft.dpi" = 120; + u.has.activitywatch = true; } diff --git a/hosts/hyuganatsu/users/ahnwuoa/default.nix b/hosts/hyuganatsu/users/ahnwuoa/default.nix index 831bd68..066ef21 100644 --- a/hosts/hyuganatsu/users/ahnwuoa/default.nix +++ b/hosts/hyuganatsu/users/ahnwuoa/default.nix @@ -9,16 +9,5 @@ ]; home.username = "ahnwuoa"; - services.activitywatch = { - enable = true; - watchers = { - aw-watcher-afk.package = pkgs.activitywatch; - aw-watcher-window.package = pkgs.activitywatch; - }; - }; - systemd.user.targets.activitywatch = { - Unit.Requires = lib.mkForce ["autostart.target"]; - Unit.After = lib.mkForce ["autostart.target"]; - Install.WantedBy = lib.mkForce ["autostart.target"]; - }; + u.has.activitywatch = true; } diff --git a/user/activitywatch.nix b/user/activitywatch.nix new file mode 100644 index 0000000..d03ee6a --- /dev/null +++ b/user/activitywatch.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: +lib.mkIf config.u.has.activitywatch { + services.activitywatch = { + enable = true; + watchers = { + aw-watcher-afk.package = pkgs.activitywatch; + aw-watcher-window.package = pkgs.activitywatch; + }; + }; + systemd.user.targets.activitywatch = { + Unit.Requires = lib.mkForce ["autostart.target"]; + Unit.After = lib.mkForce ["autostart.target"]; + Install.WantedBy = lib.mkForce ["autostart.target"]; + }; + home.packages = with pkgs; [ + activitywatch + python312Packages.aw-client + python312Packages.aw-core + ]; +} diff --git a/user/default.nix b/user/default.nix index ad98dbf..7e22862 100644 --- a/user/default.nix +++ b/user/default.nix @@ -4,6 +4,7 @@ ... }: { imports = [ + ./activitywatch.nix ./autostart.nix ./bin ./config diff --git a/user/options.nix b/user/options.nix index 63dd616..cfa0df7 100644 --- a/user/options.nix +++ b/user/options.nix @@ -43,22 +43,24 @@ }); description = "list of file manager bookmarks"; }; - has = { - graphical = lib.mkOption { - type = lib.types.bool; - description = "enable graphical settings"; - default = true; - }; - wine = lib.mkOption { - type = lib.types.bool; - description = "enable wine settings"; - default = true; - }; - prog = lib.mkOption { - type = lib.types.bool; - description = "enable prog settings"; - default = true; - }; + has = let + mkOpt = name: + lib.mkOption { + type = lib.types.bool; + description = "enable ${name}"; + default = true; + }; + mkOptF = name: + lib.mkOption { + type = lib.types.bool; + description = "enable ${name}"; + default = false; + }; + in { + graphical = mkOpt "graphical"; + wine = mkOpt "wine"; + prog = mkOpt "prog"; + activitywatch = mkOptF "activitywatch"; }; lib = lib.mkOption { type = lib.types.attrs;