From f423383ca283633fd55286abba33bb2a232f0637 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sat, 18 Nov 2023 12:16:47 +0100 Subject: [PATCH] btrbk: option to disable timer --- hosts/yodaHedgehog/btrbk-config.nix | 2 ++ modules/btrbk/backup.nix | 8 +++++--- modules/btrbk/snapshot.nix | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hosts/yodaHedgehog/btrbk-config.nix b/hosts/yodaHedgehog/btrbk-config.nix index d3c6541..d304d9f 100644 --- a/hosts/yodaHedgehog/btrbk-config.nix +++ b/hosts/yodaHedgehog/btrbk-config.nix @@ -26,6 +26,7 @@ in yoda.btrbkBackups = [ { instance = "remote-backup-ssd"; + enable = false; lz4 = false; ssh_identity = "/mnt/backup/rootNas_ed25519"; volume = "ssh://rootnas/jc-data"; @@ -35,6 +36,7 @@ in } { instance = "remote-backup-hdd"; + enable = false; lz4 = false; ssh_identity = "/mnt/backup/rootNas_ed25519"; volume = "ssh://rootnas/mnt/data/jc-data"; diff --git a/modules/btrbk/backup.nix b/modules/btrbk/backup.nix index c06d63c..35ff422 100644 --- a/modules/btrbk/backup.nix +++ b/modules/btrbk/backup.nix @@ -13,12 +13,15 @@ in type = types.listOf types.attrs; default = []; example = [{ + instance = "local-backup-ssd"; + # Optional. + # Can be used to disable timer. + #enable = false; # Optional. # If this is `true` and `volume` starts with `ssh://`, `lz4` transport compression is enabled. lz4 = true; # Optional. #ssh_identity = /root/.ssh/rootNas_ed25519; - instance = "local-backup-ssd"; volume = "/jc-data"; snapshot_dir = "/snap"; target = "/mnt/backup/snap"; @@ -47,8 +50,7 @@ in # `services.btrbk.instances` template. { "${x.instance}" = { - #onCalendar = null; - onCalendar = "00:05"; + onCalendar = if (x.enable or true) then "00:05" else null; settings = { timestamp_format = "long"; stream_compress = mkIf ((x.lz4 or false) && strings.hasPrefix "ssh://" x.volume) "lz4"; diff --git a/modules/btrbk/snapshot.nix b/modules/btrbk/snapshot.nix index 79c4479..76b1bf6 100644 --- a/modules/btrbk/snapshot.nix +++ b/modules/btrbk/snapshot.nix @@ -14,6 +14,9 @@ in default = []; example = [{ instance = "local-snapshot-ssd"; + # Optional. + # Can be used to disable timer. + #enable = false; volume = "/jc-data"; snapshot_dir = "/snap"; subvolume = { @@ -41,8 +44,7 @@ in # `services.btrbk.instances` template. { "${x.instance}" = { - #onCalendar = null; - onCalendar = "hourly"; + onCalendar = if (x.enable or true) then "hourly" else null; settings = { timestamp_format = "long";