57 lines
1.6 KiB
Nix
Raw Normal View History

2023-12-23 01:26:18 +03:00
{ config, inputs, ... }: {
2024-01-24 17:28:12 +03:00
sops.secrets.rustic-vps-pass.sopsFile = inputs.self.secretsDir + /rustic.yaml;
sops.secrets.rclone-rustic-backups.sopsFile = inputs.self.secretsDir + /rustic.yaml;
2024-01-19 17:58:20 +03:00
services.rustic.backups = rec {
2023-12-23 01:26:18 +03:00
vps-backup = {
backup = true;
prune = false;
2024-01-19 17:58:20 +03:00
initialize = false;
rcloneConfigFile = config.sops.secrets.rclone-rustic-backups.path;
rcloneOptions = { fast-list = true; };
pruneOpts = [ "--repack-cacheable-only=false" ];
2023-12-23 01:26:18 +03:00
timerConfig = {
OnCalendar = "01:00";
Persistent = true;
};
2024-01-19 17:58:20 +03:00
settings = let
bucket = "rustic-backups";
label = "vps-containers";
in {
2023-12-23 01:26:18 +03:00
repository = {
2024-01-19 17:58:20 +03:00
repository = "rclone:rustic-backups:${bucket}/${label}";
password-file = config.sops.secrets.rustic-vps-pass.path;
2023-12-23 01:26:18 +03:00
};
repository.options = {
2024-01-19 17:58:20 +03:00
timeout = "5min";
retry = "10";
2023-12-23 01:26:18 +03:00
};
backup = {
2024-01-12 23:52:30 +03:00
host = config.device;
2023-12-23 01:26:18 +03:00
label = label;
ignore-devid = true;
2024-01-19 17:58:20 +03:00
group-by = "label";
2023-12-23 01:26:18 +03:00
sources = [{
source = "/srv/marzban /srv/nextcloud/config /srv/nextcloud/data";
}];
};
forget = {
filter-label = [ label ];
2024-01-19 17:58:20 +03:00
group-by = "label";
2023-12-23 01:26:18 +03:00
prune = true;
2024-01-19 17:58:20 +03:00
keep-daily = 4;
2024-01-12 23:52:30 +03:00
keep-weekly = 2;
keep-monthly = 1;
2023-12-23 01:26:18 +03:00
};
};
};
vps-prune = vps-backup // {
backup = false;
prune = true;
createWrapper = false;
timerConfig = {
2024-01-19 17:58:20 +03:00
OnCalendar = "Mon, 02:00";
2023-12-23 01:26:18 +03:00
Persistent = true;
};
};
};
}