From 0e662cc0534fc3f8476259d05178940514bac921 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 20 Nov 2023 20:30:55 +0100 Subject: [PATCH] yodaHedgehog: backup service --- hosts/yodaHedgehog/host-specific.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hosts/yodaHedgehog/host-specific.nix b/hosts/yodaHedgehog/host-specific.nix index e0f65e8..a4414fa 100644 --- a/hosts/yodaHedgehog/host-specific.nix +++ b/hosts/yodaHedgehog/host-specific.nix @@ -48,17 +48,26 @@ in path = with pkgs; [ # Provides `ssh` openssh - # Provides `awk`, `grep`, `sleep`, `printf`, `echo`, 'sendmail' + # Provides `readlink` (with support for parameter `-e`, required by `btrbk`) + coreutils + # Provides `awk`, `grep`, `sleep`, `printf`, `echo`, 'sendmail', `readlink` (without support for parameter `-e`) busybox # Provides `smtpctl` opensmtpd + # Provides `btrbk` + btrbk + # Provides `sudo` required by `btrbk`. + # Alternatively we could configure `btrbk` to use the "btrfs-progs" instead of the "btrfs-progs-sudo" backend. But the `btrbk` NixOS module has no option for this. + sudo ]; # Script to execute as main process. script = '' set -eu -o pipefail - printf '%s\n' 'Starting backup script.' + #printf '%s\n' 'Starting backup script.' - # TODO: Backup: Pull BTRFS snapshots from ${backup-source}. + # Pull BTRFS snapshots from ${backup-source}. + btrbk -c /etc/btrbk/remote-backup-ssd.conf run + btrbk -c /etc/btrbk/remote-backup-hdd.conf run # Don't suspend as long as `${backup-source}:${stay-awake-file}` exists. while :; do @@ -105,7 +114,7 @@ in #done sleep 15s - printf '%s\n' 'Finished backup script.' + #printf '%s\n' 'Finished backup script.' # Suspend to save power. systemctl suspend '';