nixos/modules/backup.nix

34 lines
731 B
Nix
Raw Normal View History

2026-08-12 17:45:17 +02:00
{ 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" ];
};
};
}