summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}";
+ }) ;
+ };
}