From be92a488d5aed4d8c3bad48a7b11f860b5247e16 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Tue, 14 Oct 2025 17:31:46 -0400 Subject: add jq & cron --- modules/git/cron.nix | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'modules/git/cron.nix') 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"; + }; }; } -- cgit v1.2.3