about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hosts/common/nas.nix1
-rw-r--r--hosts/common/server/backups/users.nix25
2 files changed, 26 insertions, 0 deletions
diff --git a/hosts/common/nas.nix b/hosts/common/nas.nix
index 255e95e..92b0d3f 100644
--- a/hosts/common/nas.nix
+++ b/hosts/common/nas.nix
@@ -6,5 +6,6 @@
     ./server/samba.nix
     ./server/prometheus.nix
     ./server/grafana.nix
+    ./server/backups/users.nix
   ];
 }
diff --git a/hosts/common/server/backups/users.nix b/hosts/common/server/backups/users.nix
new file mode 100644
index 0000000..d56f7fe
--- /dev/null
+++ b/hosts/common/server/backups/users.nix
@@ -0,0 +1,25 @@
+{ config, ... }:
+
+{
+
+  systemd.services.backups-maintenance-fcuny = {
+    Unit = {
+      Description = "maintenance for fcuny backups";
+      Documentation = "man:restic(1)";
+    };
+    Service = {
+      Type = "oneshot";
+      User = "restic";
+      ReadWritePaths = "/data/slow/backups/users/fcuny";
+      Environment = [
+        "RESTIC_REPOSITORY=/data/slow/backups/users/fcuny"
+        "RESTIC_PASSWORD_FILE="
+      ];
+      ExecStart = [
+        "${pkgs.restic}/bin/restic --verbose rebuild-index"
+        "${pkgs.restic}/bin/restic --verbose prune"
+        "${pkgs.restic}/bin/restic --verbose forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 3"
+      ];
+    };
+  };
+}