home/git-maintenance: fix units

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-05 14:09:48 +02:00
parent b82469f51c
commit 9a4f8f5d9d
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 14 additions and 34 deletions

View File

@ -82,6 +82,8 @@ in
fsckObjects = true; fsckObjects = true;
}; };
maintenance.strategy = "incremental";
transfer.fsckObjects = true; transfer.fsckObjects = true;
receive.fsckObjects = true; receive.fsckObjects = true;

View File

@ -1,4 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
cfg = config.programs.git;
in
{ {
systemd.user.services."git-maintenance@" = { systemd.user.services."git-maintenance@" = {
Unit = { Unit = {
@ -8,7 +11,11 @@
Service = { Service = {
Type = "oneshot"; 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"; LockPersonality = "yes";
MemoryDenyWriteExecute = "yes"; MemoryDenyWriteExecute = "yes";
@ -27,14 +34,13 @@
}; };
}; };
systemd.user.timers."git-maintenance@hourly" = { systemd.user.timers."git-maintenance@" = {
Unit = { Unit = {
Description = "Optimize Git repositories data"; Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ]; Documentation = [ "man:git-maintenance(1)" ];
}; };
Timer = { Timer = {
OnCalendar = "*-*-* 1..23:05:00";
Persistent = true; Persistent = true;
}; };
@ -43,35 +49,7 @@
}; };
}; };
systemd.user.timers."git-maintenance@daily" = { systemd.user.timers."git-maintenance@hourly".Timer.OnCalendar = "*-*-* 1..23:05:00";
Unit = { systemd.user.timers."git-maintenance@daily".Timer.OnCalendar = "Tue..Sun *-*-* 0:05:00";
Description = "Optimize Git repositories data"; systemd.user.timers."git-maintenance@weekly".Timer.OnCalendar = "Mon 0:05:00";
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" ];
};
};
} }