From ff491badbb3675c97454449e4e05f060d6ff1df7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 4 Apr 2025 11:53:08 +0200 Subject: feat(modules/legacy/taskwarrior): Migrate to by-name --- modules/common/hooks/default.nix | 8 ++++++++ modules/common/hooks/scripts/sync-git-repo.sh | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 modules/common/hooks/default.nix create mode 100755 modules/common/hooks/scripts/sync-git-repo.sh (limited to 'modules/common/hooks') 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 -- cgit 1.4.1