{ config, pkgs, lib, ... }: { 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 = { description = "synchronize restic repository to GCS"; serviceConfig = let rcloneOptions = "--config=${config.age.secrets.rclone-config.path} --gcs-service-account-file=${config.age.secrets.rclone-gcs-sa.path} --fast-list --verbose"; in { Type = "oneshot"; ExecStart = [ "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups gbackup:fcuny-backups-systems" "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups gbackup:fcuny-backups-users" ]; }; }; }; }