nix-conf/modules/services/repo-sync/default.nix
2023-08-23 21:54:20 +02:00

26 lines
642 B
Nix

{ pkgs, ... }:
{
systemd.timers."repo-sync" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "15m";
Unit = "repo-sync.service";
};
};
systemd.services."repo-sync" = {
script = ''
${pkgs.git}/bin/git -C /var/lib/repo-sync pull -r codeberg main
${pkgs.git}/bin/git -C /var/lib/repo-sync pull -r github main
${pkgs.git}/bin/git -C /var/lib/repo-sync pull -r gitlab main
${pkgs.git}/bin/git -C /var/lib/repo-sync push origin
'';
path = [pkgs.openssh];
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
}