From 980295c744a92c65949a5d67533a7ed99ba19e22 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Wed, 23 Aug 2023 21:37:00 +0200 Subject: [PATCH] add repo syncer --- flake.nix | 1 + modules/services/repo-sync/default.nix | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 modules/services/repo-sync/default.nix diff --git a/flake.nix b/flake.nix index 459a60b..e87b274 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,7 @@ ./modules/asf ./modules/minecraft-server ./modules/editor + ./modules/services/repo-sync ./modules/users/jopejoe1 ./modules/users/root ./overlays diff --git a/modules/services/repo-sync/default.nix b/modules/services/repo-sync/default.nix new file mode 100644 index 0000000..cc29c74 --- /dev/null +++ b/modules/services/repo-sync/default.nix @@ -0,0 +1,25 @@ +{ 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 -r -C /var/lib/repo-sync pull codeberg + ${pkgs.git}/bin/git -r -C /var/lib/repo-sync pull github + ${pkgs.git}/bin/git -r -C /var/lib/repo-sync pull gitlab + ${pkgs.git}/bin/git -C /var/lib/repo-sync push origin + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; +}s