diff options
| author | Max Audron <audron@cocaine.farm> | 2026-01-07 13:14:18 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2026-01-07 13:14:18 +0100 |
| commit | cdae0fb511851bf703a6fce3db2062b02b0e4c05 (patch) | |
| tree | 985608c2e6943cb986ba02b4d0c30e886ff2d287 /modules/backup/default.nix | |
| parent | teamspeak switcharoo (diff) | |
add kopia module
Diffstat (limited to '')
| -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 = { }; + }; + }; +} |
