summaryrefslogtreecommitdiff
path: root/modules/git/timer-update-timestamps.nix
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-10-15 10:21:00 -0400
committerRaghuram Subramani <raghus2247@gmail.com>2025-10-15 10:21:00 -0400
commita333c097c87c8b450bcdeb8bbccbd254db958a72 (patch)
tree82d63a476035ee05f86159b29c847b2d4d458cc9 /modules/git/timer-update-timestamps.nix
parentc41d7a97ae6d543dacfb40260e9d360acdf35370 (diff)
cron->timer-update-timestamps
Diffstat (limited to 'modules/git/timer-update-timestamps.nix')
-rw-r--r--modules/git/timer-update-timestamps.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/git/timer-update-timestamps.nix b/modules/git/timer-update-timestamps.nix
new file mode 100644
index 0000000..acb27bd
--- /dev/null
+++ b/modules/git/timer-update-timestamps.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+{
+ 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";
+ };
+ };
+}