From e7b0d0ba53240f90dc01026a2f4f179cd137036b Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Wed, 26 Apr 2023 11:30:08 +0200 Subject: [PATCH] feat: more btrbk things --- capibara.nix | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/capibara.nix b/capibara.nix index f8a9ebc..6b9acb9 100644 --- a/capibara.nix +++ b/capibara.nix @@ -6,7 +6,7 @@ let home = "/home/rilla"; - run-offline-backups = pkgs.writeScriptBin "run-offline-backups" '' + offline-backups = pkgs.writeScriptBin "offline-backups" '' #!${pkgs.dash}/bin/dash set -xe @@ -16,10 +16,10 @@ let done && \ /run/wrappers/bin/doas -u btrbk \ ${pkgs.btrbk}/bin/btrbk \ - -c /etc/btrbk/offline-backups.conf \ + --config /etc/btrbk/offline-backups.conf \ --progress \ --verbose \ - run + "$@" ''; in { @@ -163,7 +163,7 @@ in { # services.thermald.enable = true; services.tlp.enable = true; services.power-profiles-daemon.enable = false; - environment.systemPackages = with pkgs; [ powertop acpi run-offline-backups ]; + environment.systemPackages = with pkgs; [ powertop acpi offline-backups ]; #services.beesd.filesystems = { # root = { @@ -199,10 +199,15 @@ in { ssh_user = "btrbk"; ssh_identity = "/etc/btrbk/id_ed25519"; backend_remote = "btrfs-progs-doas"; + snapshot_create = "onchange"; + snapshot_preserve_min = "latest"; + target_preserve_min = "all"; volume = { "ssh://narwhal:22/mnt/btr_pool" = { - snapshot_dir = "btrbk_snapshots"; + stream_buffer = "50%"; + stream_compress = "zstd"; + snapshot_dir = "btrbk_snapshots_offline"; subvolume = { backups = { }; books = { }; @@ -225,14 +230,14 @@ in { }; "ssh://suricata:22/mnt/btr_pool" = { - snapshot_dir = "btrbk_snapshots"; + stream_buffer = "50%"; + snapshot_dir = "btrbk_snapshots_offline"; compat_remote = "busybox"; subvolume = { home = { }; rancher_config = { }; backups = { }; configs = { }; - }; target = { "/mnt/backups/0/btr_backup/suricata" = { }; @@ -240,8 +245,23 @@ in { "/mnt/backups/2/btr_backup/suricata" = { }; }; }; - }; + "ssh://10.8.8.2:22/mnt/btr_pool" = { + stream_buffer = "50%"; + snapshot_dir = "btrbk_snapshots_offline"; + compat_remote = "busybox"; + subvolume = { + certs = { }; + volumes = { }; + }; + target = { + "/mnt/backups/0/btr_backup/caladan" = { }; + "/mnt/backups/1/btr_backup/caladan" = { }; + "/mnt/backups/2/btr_backup/caladan" = { }; + }; + }; + + }; }; }; };