2021-03-12 19:13:23 +00:00
|
|
|
{lib,config, ... }:
|
2018-10-21 21:04:27 +00:00
|
|
|
let
|
|
|
|
hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh );
|
|
|
|
in {
|
|
|
|
# TODO: for all enabled machines
|
2021-03-12 19:13:23 +00:00
|
|
|
options = {
|
|
|
|
makefu.backup.server.repo = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "/var/lib/borgbackup";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
services.borgbackup.repos = lib.genAttrs hosts (host: {
|
|
|
|
authorizedKeys = [ (builtins.readFile (./ssh + "/${host}.pub") ) ];
|
|
|
|
path = "${config.makefu.backup.server.repo}/${host}";
|
|
|
|
user = "borg-${host}";
|
|
|
|
}) ;
|
|
|
|
};
|
2018-10-21 21:04:27 +00:00
|
|
|
}
|