From c2bcbd7ba29c493fe1f846a3e1db6e27244e0059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 15 Jan 2023 18:54:39 +0200 Subject: [PATCH] restic backups of /var/lib --- configuration.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/configuration.nix b/configuration.nix index 0986d6c..6d24cbf 100644 --- a/configuration.nix +++ b/configuration.nix @@ -112,6 +112,27 @@ let ssh_pubkeys = { }; datasets."rpool/nixos/home".use_template = [ "prod" ]; datasets."rpool/nixos/var/lib".use_template = [ "prod" ]; + extraArgs = [ "--verbose" ]; + }; + + restic.backups = { + var_lib = { + paths = ["/var/lib/.snapshot-latest/gitea" "/var/lib/.snapshot-latest/headscale"]; + repository = "sftp:zh2769@zh2769.rsync.net:hel1-a.servers.jakst/var_lib"; + initialize = true; + passwordFile = "/var/src/secrets/restic/password"; + backupPrepareCommand = '' + mkdir -p /var/lib/.snapshot-latest + ${pkgs.util-linux}/bin/mount -t zfs $(${pkgs.zfs}/bin/zfs list -H -t snapshot -o name /var/lib | sort | tail -1) /var/lib/.snapshot-latest + ''; + backupCleanupCommand = '' + ${pkgs.util-linux}/bin/umount /var/lib/.snapshot-latest + ''; + timerConfig = { + OnCalendar = "00:05"; + RandomizedDelaySec = "1h"; + }; + }; }; openssh = {