about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hosts/common/server/rclone.nix23
1 files changed, 12 insertions, 11 deletions
diff --git a/hosts/common/server/rclone.nix b/hosts/common/server/rclone.nix
index 5e1a4d6..808273e 100644
--- a/hosts/common/server/rclone.nix
+++ b/hosts/common/server/rclone.nix
@@ -1,29 +1,30 @@
 { config, pkgs, lib, ... }:
 
 {
-  environment.systemPackages = with pkgs; [ rclone ];
-
   age.secrets.rclone-gcs-sa.file =
     ../../../secrets/rclone/gcs_service_account.json.age;
 
   age.secrets.rclone-config.file = ../../../secrets/rclone/config.ini.age;
 
   systemd = {
+    packages = [ pkgs.rclone ];
     timers.rclone-sync = {
+      description = "synchronize restic repository to GCS";
       wantedBy = [ "timers.target" ];
       partOf = [ "rclone-sync.service" ];
       timerConfig = { OnCalendar = "02:00"; };
     };
-    services.rclone-sync = let rcloneOptions = "--fast-list --verbose";
-    in {
-      serviceConfig.Type = "oneshot";
-      serviceConfig.Environment = {
-        RCLONE_GCS_SERVICE_ACCOUNT_CREDENTIALS =
-          config.age.secrets.rclone-gcs-sa.path;
+    services.rclone-sync = {
+      description = "synchronize restic repository to GCS";
+      environment.RCLONE_GCS_SERVICE_ACCOUNT_CREDENTIALS =
+        config.age.secrets.rclone-gcs-sa.path;
+      serviceConfig = {
+        Type = "oneshot";
+        ExecStart = [
+          "${pkgs.rclone}/bin/rclone --config=${config.age.secrets.rclone-config.path} --fast-list --verbose sync /data/slow/backups gbackup:fcuny-backups-systems"
+          "${pkgs.rclone}/bin/rclone --config=${config.age.secrets.rclone-config.path} --fast-list --verbose sync /data/slow/backups gbackup:fcuny-backups-users"
+        ];
       };
-      script = ''
-        ${pkgs.rclone}/bin/rclone --config=${age.secrets.rclone-config.path} sync ${rcloneOptions} /data/slow/backups gbackup:fcuny-backups
-      '';
     };
   };
 }