ma backup/server: init backup server repo option

This commit is contained in:
makefu 2021-03-12 20:13:23 +01:00
parent 89c9cacc45
commit 9c76697f52

View file

@ -1,11 +1,19 @@
{lib, ... }: {lib,config, ... }:
let let
hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh ); hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh );
in { in {
# TODO: for all enabled machines # TODO: for all enabled machines
services.borgbackup.repos = lib.genAttrs hosts (host: { options = {
authorizedKeys = [ (builtins.readFile (./ssh + "/${host}.pub") ) ]; makefu.backup.server.repo = lib.mkOption {
path = "/var/lib/borgbackup/${host}"; type = lib.types.str;
user = "borg-${host}"; 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}";
}) ;
};
} }