blob: 9b2ec5713fd9e7c2fb772e96b1fa59eeb6226fd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
{
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
./maintenance.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 = { };
};
};
config.environment.systemPackages = [ pkgs.kopia ];
}
|