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 /modules | |
parent | 458faaa8b8041c8aa87dbbfa977f595c8725c20e (diff) |
add jq & cron
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/cron.nix | 28 |
1 files changed, 23 insertions, 5 deletions
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"; + }; }; } |