summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/backup/server.nix
blob: 26e53b8c37aea5f2f55e610fcd7a60221f12c769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{lib,config, ... }:
let
  hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh );
in {
  # TODO: for all enabled machines
  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}";
    }) ;
  };
}