clan.borgbackup: drop enable option
Some checks failed
checks / checks (pull_request) Failing after 12s
checks / check-links (pull_request) Failing after 12s
checks / checks-impure (pull_request) Failing after 12s

This commit is contained in:
Jörg Thalheim 2024-03-08 11:12:34 +01:00
parent 6d76a724c0
commit b1897530c8
3 changed files with 29 additions and 34 deletions

View File

@ -75,10 +75,7 @@ in
};
system.extraDependencies = dependencies;
clanCore.state.test-backups.folders = [ "/var/test-backups" ];
clan.borgbackup = {
enable = true;
destinations.test_backup_server.repo = "borg@server:.";
};
clan.borgbackup.destinations.test_backup_server.repo = "borg@server:.";
};
};
perSystem = { nodes, pkgs, ... }: {

View File

@ -36,10 +36,7 @@
};
clanCore.secretStore = "vm";
clan.borgbackup = {
enable = true;
destinations.test.repo = "borg@localhost:.";
};
clan.borgbackup.destinations.test.repo = "borg@localhost:.";
}
];
};

View File

@ -3,34 +3,35 @@ let
cfg = config.clan.borgbackup;
in
{
options.clan.borgbackup = {
enable = lib.mkEnableOption "backups with borgbackup";
destinations = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
description = "the name of the backup job";
};
repo = lib.mkOption {
type = lib.types.str;
description = "the borgbackup repository to backup to";
};
rsh = lib.mkOption {
type = lib.types.str;
default = "ssh -i ${config.clanCore.secrets.borgbackup.secrets."borgbackup.ssh".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
description = "the rsh to use for the backup";
};
options.clan.borgbackup.destinations = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
description = "the name of the backup job";
};
}));
description = ''
destinations where the machine should be backuped to
'';
};
repo = lib.mkOption {
type = lib.types.str;
description = "the borgbackup repository to backup to";
};
rsh = lib.mkOption {
type = lib.types.str;
default = "ssh -i ${config.clanCore.secrets.borgbackup.secrets."borgbackup.ssh".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
description = "the rsh to use for the backup";
};
};
}));
default = { };
description = ''
destinations where the machine should be backuped to
'';
};
config = lib.mkIf cfg.enable {
imports = [ (lib.mkRemovedOptionModule [ "clan" "borgbackup" "enable" ] "Just define clan.borgbackup.destinations to enable it") ];
config = lib.mkIf (cfg.destinations != [ ]) {
services.borgbackup.jobs = lib.mapAttrs
(_: dest: {
paths = lib.flatten (map (state: state.folders) (lib.attrValues config.clanCore.state));