summaryrefslogtreecommitdiff
path: root/modules/git/timer-backup.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/timer-backup.nix')
-rw-r--r--modules/git/timer-backup.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/git/timer-backup.nix b/modules/git/timer-backup.nix
new file mode 100644
index 0000000..42c227d
--- /dev/null
+++ b/modules/git/timer-backup.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+
+{
+ systemd.timers."backup-repositories" = {
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnCalendar = "daily";
+ Persistent = true;
+ Unit = "backup-repositories.service";
+ };
+ };
+
+ systemd.services."backup-repositories" = {
+ script = ''
+ mkdir -p $HOME/backups
+
+ REPOSITORIES=$(find /home/git/* -name '*.git' -type d)
+
+ '';
+
+ serviceConfig = {
+ Type = "oneshot";
+ User = "git";
+ };
+ };
+}