# Dry run:
#   sudo btrbk -c /etc/btrbk/remote-backup-ssd.conf run -n
#   sudo btrbk -c /etc/btrbk/remote-backup-hdd.conf run -n
# Initial backup:
#   sudo btrbk -c /etc/btrbk/remote-backup-ssd.conf run; echo "Subject: btrbk has finished" | sendmail -f langbein@mail.de daniel@systemli.org
#   sudo btrbk -c /etc/btrbk/remote-backup-hdd.conf run; echo "Subject: btrbk has finished" | sendmail -f langbein@mail.de daniel@systemli.org

{ config, pkgs, ... }:
let
  # TODO: Remove duplicate variables below (reuse from yodaNas config).
  ssd-subvolumes = {
    "blogger.privacy1st.de" = {};
    "changedetection.p1st.de" = {};
    "cloud.privacy1st.de" = {};
    "cloud.fykml.de" = {};
    "git.privacy1st.de" = {};
    "mastodon-toot-follower.privacy1st.de" = {};
    "money.p1st.de" = {};
    "music.privacy1st.de" = {};
    "paste.p1st.de" = {};
    "proxy" = {};
    "recipe.privacy1st.de" = {};
    "traggo.privacy1st.de" = {};
  };
  hdd-subvolumes = {
    "arch.p1st.de" = {};
    "cloud.privacy1st.de" = {};
    "cloud.fykml.de" = {};
  };
in
{
  # TODO: Enable lz4 when yodaHedgehog no longer has direct LAN connection.
  yoda.btrbkBackups = [
    {
      instance = "remote-backup-ssd";
      enable = false;
      lz4 = false;
      ssh_identity = "/root/.ssh/rootNas_ed25519";
      volume = "ssh://rootNas/jc-data";
      snapshot_dir = "/snap";
      target = "/mnt/backup/snap";
      subvolume = ssd-subvolumes;
    }
    {
      instance = "remote-backup-hdd";
      enable = false;
      lz4 = false;
      ssh_identity = "/root/.ssh/rootNas_ed25519";
      volume = "ssh://rootNas/mnt/data/jc-data";
      snapshot_dir = "/mnt/data/snap2";
      target = "/mnt/backup/snap2";
      subvolume = hdd-subvolumes;
    }
  ];
}
