2023-08-23 21:37:00 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
systemd.timers."repo-sync" = {
|
|
|
|
wantedBy = [ "timers.target" ];
|
|
|
|
timerConfig = {
|
|
|
|
OnBootSec = "5m";
|
|
|
|
OnUnitActiveSec = "15m";
|
|
|
|
Unit = "repo-sync.service";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services."repo-sync" = {
|
|
|
|
script = ''
|
2023-09-27 19:22:16 +02:00
|
|
|
${pkgs.git}/bin/git clone git@codeberg.org:jopejoe1/nix-conf.git /var/lib/repo-sync
|
|
|
|
${pkgs.git}/bin/git -C /var/lib/repo-sync remote add github git@github.com:jopejoe1/nix-conf.git
|
|
|
|
${pkgs.git}/bin/git -C /var/lib/repo-sync remote add gitlab git@gitlab.com:jopejoe1/nix-conf.git
|
2023-08-23 21:54:20 +02:00
|
|
|
${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
|
2023-08-23 21:37:00 +02:00
|
|
|
${pkgs.git}/bin/git -C /var/lib/repo-sync push origin
|
2023-09-27 19:22:16 +02:00
|
|
|
${pkgs.git}/bin/git -C /var/lib/repo-sync push github
|
|
|
|
${pkgs.git}/bin/git -C /var/lib/repo-sync push gitlab
|
|
|
|
${pkgs.coreutils}/bin/rm -r /var/lib/repo-sync
|
2023-08-23 21:37:00 +02:00
|
|
|
'';
|
2023-08-23 21:47:18 +02:00
|
|
|
path = [pkgs.openssh];
|
2023-08-23 21:37:00 +02:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
User = "root";
|
|
|
|
};
|
|
|
|
};
|
2023-08-23 21:38:05 +02:00
|
|
|
}
|