diff options
Diffstat (limited to 'modules/git/cron.nix')
-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"; + }; }; } |