refactor btrbk

This commit is contained in:
Daniel Langbein 2023-11-16 11:32:15 +01:00
parent c02ee24df7
commit d0614fa608
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -1,3 +1,15 @@
# For each instance, a service and timer will be created:
# systemctl list-unit-files | grep btrbk
# #=> btrbk-<instance-name>.service
# #=> btrbk-<instance-name>.timer
#
# If onCalendar is set to `null`, one can manually execute btrbk with
# sudo systemctl start btrbk-<instance-name>.service
# Print generated systemd unit file
# cat "$(systemctl show -P FragmentPath btrbk-<instance-name>.service)"
# #=> ExecStart=/nix/store/53nvbl1c0w14524j7v3fpn9py31yi2hb-btrbk-0.32.6/bin/btrbk -c /etc/btrbk/local-backup.conf run
{ config, pkgs, ... }:
let
ssd-subvolumes = {
@ -19,20 +31,10 @@ let
# MediaKollektiv: 796 GiB
"cloud.media-kollektiv.eu" = {};
};
preserve-hourly = "24h 7d 4w 6m";
preserve-daily = "7d 4w 6m";
in
{
# For each instance, a service and timer will be created:
# systemctl list-unit-files | grep btrbk
# #=> btrbk-<instance-name>.service
# #=> btrbk-<instance-name>.timer
#
# If onCalendar is set to `null`, one can manually execute btrbk with
# sudo systemctl start btrbk-<instance-name>.service
# Print generated systemd unit file
# cat "$(systemctl show -P FragmentPath btrbk-<instance-name>.service)"
# #=> ExecStart=/nix/store/53nvbl1c0w14524j7v3fpn9py31yi2hb-btrbk-0.32.6/bin/btrbk -c /etc/btrbk/local-backup.conf run
services.btrbk = {
extraPackages = [ pkgs.lz4 ];
# Lowest scheduling priority.
@ -49,14 +51,14 @@ in
#stream_compress = "lz4";
snapshot_preserve_min = "2d";
snapshot_preserve = "24h 7d 4w 6m";
snapshot_preserve = preserve-hourly;
volume."/jc-data" = {
snapshot_dir = "/snap";
subvolume = ssd-subvolumes;
};
volume."/mnt/data/jc-data" = {
snapshot_dir = "/mnt/data/snap";
snapshot_dir = "/mnt/data/snap2";
subvolume = hdd-subvolumes;
};
};
@ -72,7 +74,7 @@ in
# Create backups.
target_preserve_min = "no";
target_preserve = "7d 4w 6m";
target_preserve = preserve-daily;
# Don't create or delete snapshots.
snapshot_preserve_min = "all";
@ -84,7 +86,7 @@ in
subvolume = ssd-subvolumes;
};
volume."/mnt/data/jc-data" = {
snapshot_dir = "/mnt/data/snap";
snapshot_dir = "/mnt/data/snap2";
target = "/mnt/backup/snap2";
subvolume = hdd-subvolumes;
};