about summary refs log tree commit diff stats
path: root/modules/common/hooks
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-04 11:53:08 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-04 11:53:08 +0200
commitff491badbb3675c97454449e4e05f060d6ff1df7 (patch)
tree2423b0e8da91b9ab3d3467650bfdf767f4b417ad /modules/common/hooks
parentfeat(pkgs/neorg): Rewrite in rust (diff)
downloadnixos-config-ff491badbb3675c97454449e4e05f060d6ff1df7.zip
feat(modules/legacy/taskwarrior): Migrate to by-name
Diffstat (limited to 'modules/common/hooks')
-rw-r--r--modules/common/hooks/default.nix8
-rwxr-xr-xmodules/common/hooks/scripts/sync-git-repo.sh13
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/common/hooks/default.nix b/modules/common/hooks/default.nix
new file mode 100644
index 00000000..e2d12807
--- /dev/null
+++ b/modules/common/hooks/default.nix
@@ -0,0 +1,8 @@
+{
+  pkgs,
+  lib,
+  config,
+}: {
+  sync-git-repos = config.lib.taskwarrior.mkHook "on-add" [pkgs.git] ./scripts/sync-git-repo.sh;
+  sync-git-repos-mod = config.lib.taskwarrior.mkHook "on-modify" [pkgs.git] ./scripts/sync-git-repo.sh;
+}
diff --git a/modules/common/hooks/scripts/sync-git-repo.sh b/modules/common/hooks/scripts/sync-git-repo.sh
new file mode 100755
index 00000000..ad7368f3
--- /dev/null
+++ b/modules/common/hooks/scripts/sync-git-repo.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+task_data="$(task _get rc.data.location)"
+[ "$task_data" ] || die "Taskwarrior should have a location set"
+
+cd "$task_data" || die "(BUG?): Your data.location path is not accessable"
+
+[ -d ./.git/ ] || git init
+
+git add .
+git commit --message="chore: Update" --no-gpg-sign
+
+# vim: ft=sh