30 lines
731 B
Nix
30 lines
731 B
Nix
{ pkgs
|
|
, lib
|
|
, config
|
|
, ...
|
|
}:
|
|
|
|
with lib; let
|
|
cfg = config.simmer.backup;
|
|
compression = if (cfg.compression == "zstd") then "auto,zstd,3" else "auto,lzma";
|
|
in
|
|
{
|
|
config = mkIf cfg.enable {
|
|
services.borgbackup.jobs = {
|
|
backup = {
|
|
user = cfg.user;
|
|
paths = cfg.paths;
|
|
exclude = cfg.excludes;
|
|
repo = cfg.repo;
|
|
encryption = {
|
|
mode = "repokey-blake2";
|
|
passCommand = "cat ${cfg.passphrase}";
|
|
};
|
|
environment.BORG_RSH = "ssh -i ${cfg.key}";
|
|
compression = compression;
|
|
startAt = cfg.repeat;
|
|
};
|
|
};
|
|
};
|
|
}
|