diff --git a/hosts/fwminex/configuration.nix b/hosts/fwminex/configuration.nix index 47996f0..e140c16 100644 --- a/hosts/fwminex/configuration.nix +++ b/hosts/fwminex/configuration.nix @@ -573,21 +573,31 @@ in }; }; - btrfsborg = { - enable = true; - passwordPath = config.age.secrets.borgbackup-password.path; - sshKeyPath = "/etc/ssh/ssh_host_ed25519_key"; - dirs = - builtins.concatMap - ( - host: - let - prefix = "${host}:${config.networking.hostName}.${config.networking.domain}"; - in - [ + btrfsborg = + let + this = "${config.networking.hostName}.${config.networking.domain}"; + vno3-nk = "borgstor@${myData.hosts."vno3-nk.jakst.vpn".jakstIP}"; + rsync-net = "zh2769@zh2769.rsync.net"; + in + { + enable = true; + passwordPath = config.age.secrets.borgbackup-password.path; + sshKeyPath = "/etc/ssh/ssh_host_ed25519_key"; + dirs = + [ + { + subvolume = "/var/lib"; + repo = "${vno3-nk}:${this}-timelapse-r11"; + paths = [ "private/timelapse-r11" ]; + backup_at = "*-*-* 02:01:00 UTC"; + compression = "none"; + } + ] + ++ (builtins.concatMap + (host: [ { subvolume = "/var/lib"; - repo = "${prefix}-var_lib"; + repo = "${host}:${this}-var_lib"; paths = [ "hass" "gitea" @@ -597,7 +607,6 @@ in "bitwarden_rs" "matrix-synapse" "private/soju" - "private/timelapse-r11" # https://immich.app/docs/administration/backup-and-restore/ "immich/library" @@ -610,17 +619,17 @@ in } { subvolume = "/home"; - repo = "${prefix}-home-motiejus-annex2"; + repo = "${host}:${this}-home-motiejus-annex2"; paths = [ "motiejus/annex2" ]; backup_at = "*-*-* 02:30:01 UTC"; } + ]) + [ + rsync-net + vno3-nk ] - ) - [ - "zh2769@zh2769.rsync.net" - "borgstor@${myData.hosts."vno3-nk.jakst.vpn".jakstIP}" - ]; - }; + ); + }; btrfssnapshot = { enable = true; diff --git a/hosts/vno3-nk/configuration.nix b/hosts/vno3-nk/configuration.nix index e75fb4f..70fce72 100644 --- a/hosts/vno3-nk/configuration.nix +++ b/hosts/vno3-nk/configuration.nix @@ -125,31 +125,47 @@ in verboseLogs = false; }; - btrfsborg = { - enable = true; - passwordPath = config.age.secrets.borgbackup-password.path; - sshKeyPath = "/etc/ssh/ssh_host_ed25519_key"; - dirs = - builtins.concatMap - ( - host: - let - prefix = "${host}:${config.networking.hostName}.${config.networking.domain}"; - in + btrfsborg = + let + this = "${config.networking.hostName}.${config.networking.domain}"; + rsync-net = "zh2769@zh2769.rsync.net"; + fwminex = "borgstor@${myData.hosts."fwminex.jakst.vpn".jakstIP}"; + in + { + enable = true; + passwordPath = config.age.secrets.borgbackup-password.path; + sshKeyPath = "/etc/ssh/ssh_host_ed25519_key"; + dirs = + #[ + #{ + # subvolume = "/data"; + # repo = "${fwminex}:${this}-timelapse-r11"; + # paths = [ "timelapse-r11" ]; + # backup_at = "*-*-* 02:01:00 UTC"; + # compression = "none"; + #} + #] ++ ( + builtins.concatMap + ( + host: + let + prefix = "${host}:${this}"; + in + [ + { + subvolume = "/data"; + repo = "${prefix}-data"; + paths = [ "vno3-shared" ]; + backup_at = "*-*-* 01:00:01 UTC"; + } + ] + ) [ - { - subvolume = "/data"; - repo = "${prefix}-data"; - paths = [ "vno3-shared" ]; - backup_at = "*-*-* 01:00:01 UTC"; - } - ] - ) - [ - "zh2769@zh2769.rsync.net" - "borgstor@${myData.hosts."fwminex.jakst.vpn".jakstIP}" - ]; - }; + rsync-net + fwminex + ]; + #); + }; btrfssnapshot = { enable = true; diff --git a/modules/services/btrfsborg/default.nix b/modules/services/btrfsborg/default.nix index 4136b0a..ce993c8 100644 --- a/modules/services/btrfsborg/default.nix +++ b/modules/services/btrfsborg/default.nix @@ -33,6 +33,10 @@ in default = { }; }; backup_at = lib.mkOption { type = str; }; + compression = lib.mkOption { + type = str; + default = "auto,zstd,10"; + }; }; }); }; @@ -59,7 +63,7 @@ in "config.mj.base.unitstatus.enable must be true"; lib.nameValuePair "${lib.strings.sanitizeDerivationName subvolume}-${toString i}" ( { - inherit (attrs) repo paths; + inherit (attrs) repo paths compression; doInit = true; encryption = { @@ -67,7 +71,6 @@ in passCommand = "cat ${cfg.passwordPath}"; }; extraArgs = "--remote-path=borg1"; - compression = "auto,zstd,10"; extraCreateArgs = "--chunker-params buzhash,10,23,16,4095"; startAt = attrs.backup_at; preHook = ''