34 lines
731 B
Nix
34 lines
731 B
Nix
|
|
{ lib, config, ... }:
|
||
|
|
let
|
||
|
|
cfg = config.services.backup;
|
||
|
|
in
|
||
|
|
{
|
||
|
|
options.services.backup = {
|
||
|
|
enable = lib.mkEnableOption "Whether to enable backups or not.";
|
||
|
|
|
||
|
|
source = lib.mkOption {
|
||
|
|
type = lib.types.path;
|
||
|
|
default = null;
|
||
|
|
description = "The path to save.";
|
||
|
|
};
|
||
|
|
|
||
|
|
dest = lib.mkOption {
|
||
|
|
type = lib.types.either lib.types.path lib.types.str;
|
||
|
|
default = null;
|
||
|
|
description = "A destination for the backup.";
|
||
|
|
};
|
||
|
|
|
||
|
|
encryption = {
|
||
|
|
key = lib.mkOption {
|
||
|
|
type = lib.types.path;
|
||
|
|
description = "A key to encrypt backups.";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
config = lib.mkIf cfg.enable {
|
||
|
|
systemd.services.backup = {
|
||
|
|
wantedBy = [ "multi-user.target" ];
|
||
|
|
};
|
||
|
|
};
|
||
|
|
}
|