{ config, pkgs, ... }:
{
  services.postgresql.backup = {
    enable = true;
    location = "/var/lib/data/backups/postgres";
    databases = [ "immich" "paperless" "nextcloud" "vaultwarden" ];
  };
 
  services.borgbackup.jobs."daily-backup" = {
   
    paths = [
      "/var/lib/data"          
      "/var/lib/vaultwarden"   
    ];
    
    exclude = [
      "**/cache"
      "**/.cache"
      "/var/lib/data/immich/thumbs"
    ];
   
    repo = "/var/lib/backup/borg-repo";
   
    encryption.mode = "none"; 

    compression = "zstd,1";
    startAt = "daily";

    prune.keep = {
      within = "1d";
      daily = 7;
      weekly = 4;
      monthly = 6;
    };
  };
}
