clan.borgbackup: drop enable option
This commit is contained in:
@@ -75,10 +75,7 @@ in
|
|||||||
};
|
};
|
||||||
system.extraDependencies = dependencies;
|
system.extraDependencies = dependencies;
|
||||||
clanCore.state.test-backups.folders = [ "/var/test-backups" ];
|
clanCore.state.test-backups.folders = [ "/var/test-backups" ];
|
||||||
clan.borgbackup = {
|
clan.borgbackup.destinations.test_backup_server.repo = "borg@server:.";
|
||||||
enable = true;
|
|
||||||
destinations.test_backup_server.repo = "borg@server:.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
perSystem = { nodes, pkgs, ... }: {
|
perSystem = { nodes, pkgs, ... }: {
|
||||||
|
|||||||
@@ -36,10 +36,7 @@
|
|||||||
};
|
};
|
||||||
clanCore.secretStore = "vm";
|
clanCore.secretStore = "vm";
|
||||||
|
|
||||||
clan.borgbackup = {
|
clan.borgbackup.destinations.test.repo = "borg@localhost:.";
|
||||||
enable = true;
|
|
||||||
destinations.test.repo = "borg@localhost:.";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ let
|
|||||||
cfg = config.clan.borgbackup;
|
cfg = config.clan.borgbackup;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.clan.borgbackup = {
|
options.clan.borgbackup.destinations = lib.mkOption {
|
||||||
enable = lib.mkEnableOption "backups with borgbackup";
|
|
||||||
destinations = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
@@ -25,12 +23,15 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
destinations where the machine should be backuped to
|
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
|
services.borgbackup.jobs = lib.mapAttrs
|
||||||
(_: dest: {
|
(_: dest: {
|
||||||
paths = lib.flatten (map (state: state.folders) (lib.attrValues config.clanCore.state));
|
paths = lib.flatten (map (state: state.folders) (lib.attrValues config.clanCore.state));
|
||||||
|
|||||||
Reference in New Issue
Block a user