diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-14 17:31:46 -0400 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-14 17:31:46 -0400 |
commit | be92a488d5aed4d8c3bad48a7b11f860b5247e16 (patch) | |
tree | f4696688da8c298991a149b2433737612d2cfef8 | |
parent | 458faaa8b8041c8aa87dbbfa977f595c8725c20e (diff) |
add jq & cron
-rw-r--r-- | machines/oxo/git-home.nix | 1 | ||||
-rw-r--r-- | machines/oxo/home.nix | 1 | ||||
-rw-r--r-- | modules/git/cron.nix | 28 |
3 files changed, 25 insertions, 5 deletions
diff --git a/machines/oxo/git-home.nix b/machines/oxo/git-home.nix index c2bff08..9d92422 100644 --- a/machines/oxo/git-home.nix +++ b/machines/oxo/git-home.nix @@ -7,6 +7,7 @@ }; home.packages = with pkgs; [ + jq git-lfs ]; diff --git a/machines/oxo/home.nix b/machines/oxo/home.nix index 8672e15..c43b9b0 100644 --- a/machines/oxo/home.nix +++ b/machines/oxo/home.nix @@ -11,6 +11,7 @@ fzf fd ripgrep + jq unzip zip diff --git a/modules/git/cron.nix b/modules/git/cron.nix index 26fb444..acb27bd 100644 --- a/modules/git/cron.nix +++ b/modules/git/cron.nix @@ -1,10 +1,28 @@ { config, lib, pkgs, ... }: { - services.cron = { - enable = true; - systemCronJobs = [ - "* * * * * git /home/git/git-shell-commands/update-timestamps" - ]; + systemd.timers."update-timestamps" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "10s"; + OnUnitActiveSec = "10s"; + Unit = "update-timestamps.service"; + }; + }; + + systemd.services."update-timestamps" = { + script = '' + REPOSITORIES=$(find /home/git/* -name '*.git' -type d) + + for repo in $REPOSITORIES; do + cd $repo + mkdir -p info/web + echo $(${pkgs.git}/bin/git log -1 --date=iso --format=%ci) > info/web/last-modified + done + ''; + serviceConfig = { + Type = "oneshot"; + User = "git"; + }; }; } |