From 9a4f8f5d9d1cd52572f774d0453465ea7b06c620 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 5 Aug 2024 14:09:48 +0200 Subject: [PATCH] home/git-maintenance: fix units --- home/programs/git/default.nix | 2 ++ home/services/git-maintenance.nix | 46 ++++++++----------------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/home/programs/git/default.nix b/home/programs/git/default.nix index a201ea2..03733cd 100644 --- a/home/programs/git/default.nix +++ b/home/programs/git/default.nix @@ -82,6 +82,8 @@ in fsckObjects = true; }; + maintenance.strategy = "incremental"; + transfer.fsckObjects = true; receive.fsckObjects = true; diff --git a/home/services/git-maintenance.nix b/home/services/git-maintenance.nix index ca9d616..6984186 100644 --- a/home/services/git-maintenance.nix +++ b/home/services/git-maintenance.nix @@ -1,4 +1,7 @@ { config, pkgs, lib, ... }: +let + cfg = config.programs.git; +in { systemd.user.services."git-maintenance@" = { Unit = { @@ -8,7 +11,11 @@ Service = { Type = "oneshot"; - ExecStart = "${lib.getExe pkgs.git} for-each-repo --config=maintenance.repo maintenance run --schedule=%i"; + ExecStart = "${lib.getExe pkgs.git} for-each-repo --config=maintenance.repo maintenance run --no-quiet --schedule=%i"; + + Environment = [ + "PATH=${lib.makeBinPath (with pkgs; [ cfg.package openssh ])}" + ]; LockPersonality = "yes"; MemoryDenyWriteExecute = "yes"; @@ -27,14 +34,13 @@ }; }; - systemd.user.timers."git-maintenance@hourly" = { + systemd.user.timers."git-maintenance@" = { Unit = { Description = "Optimize Git repositories data"; Documentation = [ "man:git-maintenance(1)" ]; }; Timer = { - OnCalendar = "*-*-* 1..23:05:00"; Persistent = true; }; @@ -43,35 +49,7 @@ }; }; - systemd.user.timers."git-maintenance@daily" = { - Unit = { - Description = "Optimize Git repositories data"; - Documentation = [ "man:git-maintenance(1)" ]; - }; - - Timer = { - OnCalendar = "Tue..Sun *-*-* 0:05:00"; - Persistent = true; - }; - - Install = { - WantedBy = [ "timers.target" ]; - }; - }; - - systemd.user.timers."git-maintenance@weekly" = { - Unit = { - Description = "Optimize Git repositories data"; - Documentation = [ "man:git-maintenance(1)" ]; - }; - - Timer = { - OnCalendar = "Mon 0:05:00"; - Persistent = true; - }; - - Install = { - WantedBy = [ "timers.target" ]; - }; - }; + systemd.user.timers."git-maintenance@hourly".Timer.OnCalendar = "*-*-* 1..23:05:00"; + systemd.user.timers."git-maintenance@daily".Timer.OnCalendar = "Tue..Sun *-*-* 0:05:00"; + systemd.user.timers."git-maintenance@weekly".Timer.OnCalendar = "Mon 0:05:00"; }