diff --git a/modules/btrbk/default.nix b/modules/btrbk/default.nix index ab557a0..00b5c04 100644 --- a/modules/btrbk/default.nix +++ b/modules/btrbk/default.nix @@ -1,3 +1,15 @@ +# For each instance, a service and timer will be created: +# systemctl list-unit-files | grep btrbk +# #=> btrbk-.service +# #=> btrbk-.timer +# +# If onCalendar is set to `null`, one can manually execute btrbk with +# sudo systemctl start btrbk-.service + +# Print generated systemd unit file +# cat "$(systemctl show -P FragmentPath btrbk-.service)" +# #=> ExecStart=/nix/store/53nvbl1c0w14524j7v3fpn9py31yi2hb-btrbk-0.32.6/bin/btrbk -c /etc/btrbk/local-backup.conf run + { config, pkgs, ... }: let ssd-subvolumes = { @@ -19,20 +31,10 @@ let # MediaKollektiv: 796 GiB "cloud.media-kollektiv.eu" = {}; }; + preserve-hourly = "24h 7d 4w 6m"; + preserve-daily = "7d 4w 6m"; in { - # For each instance, a service and timer will be created: - # systemctl list-unit-files | grep btrbk - # #=> btrbk-.service - # #=> btrbk-.timer - # - # If onCalendar is set to `null`, one can manually execute btrbk with - # sudo systemctl start btrbk-.service - - # Print generated systemd unit file - # cat "$(systemctl show -P FragmentPath btrbk-.service)" - # #=> ExecStart=/nix/store/53nvbl1c0w14524j7v3fpn9py31yi2hb-btrbk-0.32.6/bin/btrbk -c /etc/btrbk/local-backup.conf run - services.btrbk = { extraPackages = [ pkgs.lz4 ]; # Lowest scheduling priority. @@ -49,14 +51,14 @@ in #stream_compress = "lz4"; snapshot_preserve_min = "2d"; - snapshot_preserve = "24h 7d 4w 6m"; + snapshot_preserve = preserve-hourly; volume."/jc-data" = { snapshot_dir = "/snap"; subvolume = ssd-subvolumes; }; volume."/mnt/data/jc-data" = { - snapshot_dir = "/mnt/data/snap"; + snapshot_dir = "/mnt/data/snap2"; subvolume = hdd-subvolumes; }; }; @@ -72,7 +74,7 @@ in # Create backups. target_preserve_min = "no"; - target_preserve = "7d 4w 6m"; + target_preserve = preserve-daily; # Don't create or delete snapshots. snapshot_preserve_min = "all"; @@ -84,7 +86,7 @@ in subvolume = ssd-subvolumes; }; volume."/mnt/data/jc-data" = { - snapshot_dir = "/mnt/data/snap"; + snapshot_dir = "/mnt/data/snap2"; target = "/mnt/backup/snap2"; subvolume = hdd-subvolumes; };