summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/backup
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-03-12 20:13:23 +0100
committermakefu <github@syntax-fehler.de>2021-03-12 20:13:23 +0100
commitca37236a537b980066205a6d2f5309fa3eb8e0e0 (patch)
tree446a4f910bced24e5fc4c1e4c09f2d56c1717dcc /makefu/2configs/backup
parente377be755fa38b0ea4936b4c55dedfab4200bf21 (diff)
ma backup/server: init backup server repo option
Diffstat (limited to 'makefu/2configs/backup')
-rw-r--r--makefu/2configs/backup/server.nix20
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}";
+ }) ;
+ };
}