nixos-config/system/all/restic.nix

37 lines
870 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, lib, ... }:
{
options = {
backup.all.restic.dirs = lib.mkOption {
default = [];
type = with lib.types; listOf str;
};
};
config = {
backup.services.restic =
let
setup = server: {
passwordFile = toString <secrets/backup/restic-repo>;
repo = "sftp::backup/remote-${config.networking.hostName}";
requires = [];
extraArguments = [
"sftp.command='ssh backup@${server} -i ${toString <secrets/backup/sftp-user_rsa>} -s sftp'"
];
initialize = true;
timerConfig = {
OnCalendar = "daily";
Persistent = "true";
};
dirs = config.backup.all.restic.dirs;
};
in
{
"on-porani" = setup "porani.private";
"on-workhorse" = setup "workhorse.private";
"on-workout" = setup "workout.private";
};
};
}