about summary refs log tree commit diff stats
path: root/hm/soispha/conf/taskwarrior/hooks/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hm/soispha/conf/taskwarrior/hooks/default.nix')
-rw-r--r--hm/soispha/conf/taskwarrior/hooks/default.nix27
1 files changed, 20 insertions, 7 deletions
diff --git a/hm/soispha/conf/taskwarrior/hooks/default.nix b/hm/soispha/conf/taskwarrior/hooks/default.nix
index 208397bc..31d97529 100644
--- a/hm/soispha/conf/taskwarrior/hooks/default.nix
+++ b/hm/soispha/conf/taskwarrior/hooks/default.nix
@@ -2,10 +2,11 @@
   sysLib,
   pkgs,
   lib,
+  config,
   ...
 }: let
   enforce_policies = sysLib.writeShellScriptWithLibrary {
-    name = "enforce_policies.taskwarrior-hook";
+    name = "bin";
     src = ./scripts/on-add_enforce-policies.sh;
     dependencies = with pkgs; [dash jq taskwarrior gnused gnugrep];
     replacementStrings = let
@@ -63,12 +64,24 @@
     dontUnpack = true;
     installPhase = "install -Dm755 ${./scripts/on-modify_track-total-active-time.py} $out/bin/bin";
   };
-in {
-  xdg = {
-    dataFile = {
-      "task/hooks/on-add_enforce-policies".source = "${enforce_policies}/bin/enforce_policies.taskwarrior-hook";
-      "task/hooks/on-modify_track-timewarrior".source = "${track_timewarrior}/bin/bin";
-      "task/hooks/on-modify_track-total-active-time".source = "${track_total_active_time}/bin/bin";
+
+  mkSyncGitRepo = type: {
+    name = "${hookPath}/${type}_sync-git-repo";
+    value = {
+      source = "${sysLib.writeShellScriptWithLibrary {
+        name = "bin";
+        src = ./scripts + "/${type}_sync-git-repo.sh";
+        dependencies = with pkgs; [dash taskwarrior git];
+      }}/bin/bin";
     };
   };
+  sync_git_repos =
+    builtins.listToAttrs (builtins.map mkSyncGitRepo ["on-add" "on-modify"]);
+  hookPath = config.programs.taskwarrior.config.hooks.location;
+in {
+  home.file = {
+    "${hookPath}/on-add_enforce-policies".source = "${enforce_policies}/bin/bin";
+    "${hookPath}/on-modify_track-timewarrior".source = "${track_timewarrior}/bin/bin";
+    "${hookPath}/on-modify_track-total-active-time".source = "${track_total_active_time}/bin/bin";
+  } // sync_git_repos;
 }