mirror of
https://codeberg.org/jopejoe1/nix-conf.git
synced 2025-01-06 11:26:50 +01:00
31 lines
1 KiB
Nix
31 lines
1 KiB
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 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
|
|
${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
|
|
${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
|
|
'';
|
|
path = [pkgs.openssh];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = "root";
|
|
};
|
|
};
|
|
}
|