diff options
author | makefu <github@syntax-fehler.de> | 2021-03-12 20:13:23 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2021-03-12 20:13:23 +0100 |
commit | ca37236a537b980066205a6d2f5309fa3eb8e0e0 (patch) | |
tree | 446a4f910bced24e5fc4c1e4c09f2d56c1717dcc /makefu/2configs/backup | |
parent | e377be755fa38b0ea4936b4c55dedfab4200bf21 (diff) |
ma backup/server: init backup server repo option
Diffstat (limited to 'makefu/2configs/backup')
-rw-r--r-- | makefu/2configs/backup/server.nix | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/makefu/2configs/backup/server.nix b/makefu/2configs/backup/server.nix index f157e715f..26e53b8c3 100644 --- a/makefu/2configs/backup/server.nix +++ b/makefu/2configs/backup/server.nix @@ -1,11 +1,19 @@ -{lib, ... }: +{lib,config, ... }: let hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh ); in { # TODO: for all enabled machines - services.borgbackup.repos = lib.genAttrs hosts (host: { - authorizedKeys = [ (builtins.readFile (./ssh + "/${host}.pub") ) ]; - path = "/var/lib/borgbackup/${host}"; - user = "borg-${host}"; - }) ; + 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}"; + }) ; + }; } |