Fix enableBackups flag

This commit is contained in:
asonix 2023-05-14 11:34:10 -05:00
parent c3eb7822aa
commit ef050a50a0
2 changed files with 35 additions and 36 deletions

View file

@ -440,6 +440,7 @@
, selfIp
, unlockMounts ? true
, mountVolumes ? true
, enableBackups ? true
, backupHosts ? [ ]
}:
let
@ -455,7 +456,7 @@
(btrbkModule {
instances = backupHosts;
localMountDir = mountDir;
enabled = unlockMounts && mountVolumes;
enabled = unlockMounts && mountVolumes && enableBackups;
})
({ config, lib, pkgs, ... }:
let

View file

@ -96,40 +96,38 @@ in
else
[ ]);
services.btrbk =
if enabled then {
sshAccess = [{
key =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTqU3EvTgY5/e9m6YyQWypQPK58t9iPmPnPYAvnODGB asonix@lionheart";
roles = [ "source" "info" "send" ];
}];
extraPackages = with pkgs; [ gzip ];
instances =
if localMountDir == null then
(builtins.foldl'
(acc:
{ primaryIp ? null, mountDir, subvolumes, name ? "btrbk" }:
let
selected =
if primaryIp == null then
(primary mountDir subvolumes)
else
(secondary primaryIp mountDir subvolumes);
in
acc // {
${name} = {
onCalendar = "hourly";
settings = selected;
};
})
{ }
instances)
else {
btrbk = {
onCalendar = "hourly";
settings = (backup instances);
};
services.btrbk = {
sshAccess = [{
key =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTqU3EvTgY5/e9m6YyQWypQPK58t9iPmPnPYAvnODGB asonix@lionheart";
roles = [ "source" "info" "send" ];
}];
extraPackages = with pkgs; [ gzip ];
instances =
if localMountDir == null then
(builtins.foldl'
(acc:
{ primaryIp ? null, mountDir, subvolumes, name ? "btrbk" }:
let
selected =
if primaryIp == null then
(primary mountDir subvolumes)
else
(secondary primaryIp mountDir subvolumes);
in
acc // {
${name} = {
onCalendar = "hourly";
settings = selected;
};
})
{ }
instances)
else if enabled then {
btrbk = {
onCalendar = "hourly";
settings = (backup instances);
};
} else
{ };
} else { };
};
}