looks fine

This commit is contained in:
Ingolf Wagner 2019-10-28 18:33:40 +01:00
parent f92e1ec78b
commit bfbad5285e
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -8,29 +8,46 @@
}; };
}; };
config = { config = let
servers = ["porani" "workhorse" "workout"];
dirs = config.backup.all.restic.dirs;
backup.services.restic = setup = server: {
let passwordFile = toString <secrets/backup/restic-repo>;
setup = server: { repo = "sftp::backup/remote-${config.networking.hostName}";
passwordFile = toString <secrets/backup/restic-repo>; requires = [];
repo = "sftp::backup/remote-${config.networking.hostName}"; extraArguments = [
requires = []; "sftp.command='ssh backup@${server} -i ${toString <secrets/backup/sftp-user_rsa>} -s sftp'"
extraArguments = [ ];
"sftp.command='ssh backup@${server} -i ${toString <secrets/backup/sftp-user_rsa>} -s sftp'" initialize = true;
]; timerConfig = {
initialize = true; OnCalendar = "daily";
timerConfig = { Persistent = "true";
OnCalendar = "daily";
Persistent = "true";
};
dirs = config.backup.all.restic.dirs;
}; };
in dirs = dirs;
{ };
"on-porani" = setup "porani.private";
"on-workhorse" = setup "workhorse.private"; hostname = config.networking.hostName;
"on-workout" = setup "workout.private"; infoEntry = server: {
restic = {
folders = dirs;
from = hostname;
to = server;
};
};
in {
backup.services.restic = lib.zipAttrsWith
(name: vals: lib.head vals)
(map (server: {
"on-${server}" = setup "${server}.private";
}) servers);
environment.etc."info/restic-${hostname}.json" = {
enable = true;
text = builtins.toJSON (map infoEntry servers);
}; };
}; };
} }