diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-06-30 12:58:03 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-06-30 12:58:03 -0700 |
| commit | 35e7f35d0e4809d752a5dc02c1ec3521fc452ffb (patch) | |
| tree | eccfe53fd096f3dcd9e25c2807d0bc6c444bbf78 /nix/machines/vm-synology/backups.nix | |
| parent | add configuration for vm-synology (diff) | |
| download | infra-35e7f35d0e4809d752a5dc02c1ec3521fc452ffb.tar.gz | |
backup the VM to Google Cloud Storage
For now we only backup git repositories.
Diffstat (limited to 'nix/machines/vm-synology/backups.nix')
| -rw-r--r-- | nix/machines/vm-synology/backups.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/nix/machines/vm-synology/backups.nix b/nix/machines/vm-synology/backups.nix new file mode 100644 index 0000000..69dcb6e --- /dev/null +++ b/nix/machines/vm-synology/backups.nix @@ -0,0 +1,40 @@ +{ + pkgs, + config, + ... +}: +let + environmentFile = toString ( + pkgs.writeText "restic-gcs-env" '' + GOOGLE_PROJECT_ID=fcuny-backups-464518 + GOOGLE_APPLICATION_CREDENTIALS=${config.age.secrets.restic_gcs_credentials.path} + '' + ); +in +{ + # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/backup/restic.nix + services.restic.backups.git = { + passwordFile = config.age.secrets.restic_password.path; + environmentFile = environmentFile; + repository = "gs:fcuny-backup:/vm-synology"; + initialize = true; + paths = [ "/var/lib/gitolite" ]; + exclude = [ + "/var/lib/gitolite/.bash_history" + "/var/lib/gitolite/.ssh" + "/var/lib/gitolite/.viminfo" + ]; + extraBackupArgs = [ + "--exclude-caches" + "--compression=max" + ]; + timerConfig = { + OnCalendar = "daily"; + }; + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 4" + "--keep-monthly 3" + ]; + }; +} |
