From bccefbc4ba2bdef8d3dfe72eaf5b0e4a57984db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 26 Jul 2023 12:59:19 +0300 Subject: [PATCH] split backup dirs to their repos --- hosts/hel1-a/configuration.nix | 7 ++++--- modules/base/zfsborg/default.nix | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hosts/hel1-a/configuration.nix b/hosts/hel1-a/configuration.nix index 099d23b..a1f785d 100644 --- a/hosts/hel1-a/configuration.nix +++ b/hosts/hel1-a/configuration.nix @@ -50,24 +50,25 @@ in { zfsborg = { enable = true; - repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst"; passwordPath = config.age.secrets.borgbackup-password.path; mountpoints = { "/var/lib" = { + repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst-var_lib"; paths = [ "/var/lib/.snapshot-latest/gitea" "/var/lib/.snapshot-latest/headscale" "/var/lib/.snapshot-latest/matrix-synapse" ]; - backup_at = "*-*-* 00:11:00"; + backup_at = "*-*-* 00:05:00"; }; "/var/log" = { + repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst-var_log"; paths = ["/var/log/.snapshot-latest/caddy/"]; patterns = [ "+ /var/log/.snapshot-latest/caddy/access-jakstys.lt.log-*.zst" "- *" ]; - backup_at = "*-*-* 00:10:00"; + backup_at = "*-*-* 00:01:00"; }; }; }; diff --git a/modules/base/zfsborg/default.nix b/modules/base/zfsborg/default.nix index 56823f6..763281a 100644 --- a/modules/base/zfsborg/default.nix +++ b/modules/base/zfsborg/default.nix @@ -18,7 +18,6 @@ in { options.mj.base.zfsborg = with lib.types; { enable = lib.mkEnableOption "backup zfs snapshots with borg"; - repo = lib.mkOption {type = str;}; passwordPath = lib.mkOption {type = str;}; mountpoints = lib.mkOption { @@ -26,6 +25,7 @@ in { type = attrsOf (submodule ( {...}: { options = { + repo = lib.mkOption {type = str;}; paths = lib.mkOption {type = listOf path;}; patterns = lib.mkOption { type = listOf str; @@ -65,7 +65,7 @@ in { value = { doInit = true; - repo = config.mj.base.zfsborg.repo; + repo = attrs.repo; encryption = { mode = "repokey-blake2"; passCommand = "cat ${config.mj.base.zfsborg.passwordPath}";