diff options
author | lassulus <lassulus@lassul.us> | 2021-03-17 15:42:13 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2021-03-17 15:42:13 +0100 |
commit | 3d1472a7cac3ab2c5f9efd06a501368308681999 (patch) | |
tree | 950fbe49dfd060923756dd517c41f27f646857de /makefu/2configs/backup | |
parent | f659c1879f6e0a0e9228205edd794aaab467aa0b (diff) | |
parent | 2044ad632b68ce173463287a9f437aae699bda83 (diff) |
Merge remote-tracking branch 'gum/master'
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}"; + }) ; + }; } |