home/git: preexec maintenance with repo discovery script

This commit is contained in:
2025-04-28 10:31:41 +02:00
parent 479434f156
commit f85ed829a9
3 changed files with 32 additions and 10 deletions

View File

@@ -333,6 +333,35 @@ in
})
];
systemd.user.services."git-maintenance@".Service = lib.mkIf cfg.maintenance.enable {
ExecStartPre = let
repoDirs = lib.escapeShellArgs [
"${config.home.homeDirectory}/git"
"${config.home.homeDirectory}/work"
"${config.home.homeDirectory}/pvv"
];
script = pkgs.writeShellApplication {
name = "discover-git-maintenance-repos";
text = ''
{
echo "[maintenance]"
for repoLocation in ${repoDirs}; do
for repo in "$repoLocation"/*/.git; do
echo "repo = $(realpath "''${repo%"/.git"}")"
done
done
} > "$1"
'';
};
in "${lib.getExe script} %t/maintenance-repos";
ExecStart = lib.mkForce ''
"${lib.getExe cfg.package}" -c include.path="%t/maintenance-repos" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%i
'';
};
home.packages = [
(pkgs.writeShellApplication {
name = "git-tcommit";