server-configs/shared/applications/server/restic.nix

32 lines
821 B
Nix

{ config, lib, ... }:
let
s3_bucketname = "rummepungen";
s3_url = "fsn1.your-objectstorage.com/${s3_bucketname}";
s3_path = "gerd_backup";
in {
services.restic = {
backups.main = {
repository = "s3:${s3_url}/${s3_path}";
passwordFile = config.age.secrets."restic-pass".path;
environmentFile = config.age.secrets."restic-env".path;
# take all `.*/safe/.*` and `.*/backup/.*` zfs volumes
paths = let
backupPaths = lib.filterAttrs (n: _:
(lib.hasInfix "/safe/" n) || (lib.hasInfix "/backup/" n)
) config.mine.zfsMounts;
in lib.attrValues backupPaths;
initialize = true;
runCheck = true;
pruneOpts = [
"--keep-last 7"
"--keep-weekly 4"
"--keep-monthly 6"
"--keep-yearly 2"
];
};
};
}