diff options
Diffstat (limited to 'modules/backup/default.nix')
| -rw-r--r-- | modules/backup/default.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/backup/default.nix b/modules/backup/default.nix new file mode 100644 index 0000000..ed319f2 --- /dev/null +++ b/modules/backup/default.nix @@ -0,0 +1,50 @@ +{ + lib, + pkgs, + ... +}: +let + instanceType = lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enable Kopia instance"; + user = lib.mkOption { + type = lib.types.str; + default = "root"; + description = "User under which the Kopia instance runs."; + }; + environmentFile = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = "File containing environment variables for kopia like password."; + }; + }; + }; + mkInstanceServices = + instances: + serviceCreator: + lib.pipe instances [ + (lib.attrsets.mapAttrs' serviceCreator) + (lib.recursiveUpdate { }) + ]; +in +{ + imports = [ + { + _module.args.mkInstanceServices = mkInstanceServices; + imports = [ + ./repositories.nix + ./snapshot.nix + ./policy.nix + ./web.nix + ]; + } + ]; + + options.services.kopia = { + enable = lib.mkEnableOption "Enable Kopia backup"; + instances = lib.mkOption { + type = lib.types.attrsOf instanceType; + default = { }; + }; + }; +} |
