mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-22 22:09:34 +01:00
99 lines
2.7 KiB
Nix
99 lines
2.7 KiB
Nix
# 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 = {
|
|
"arch.p1st.de" = {};
|
|
"blogger.privacy1st.de" = {};
|
|
"changedetection.p1st.de" = {};
|
|
"cloud.privacy1st.de" = {};
|
|
"git.privacy1st.de" = {};
|
|
"mastodon-toot-follower.privacy1st.de" = {};
|
|
"money.p1st.de" = {};
|
|
"music.privacy1st.de" = {};
|
|
"paste.p1st.de" = {};
|
|
"proxy" = {};
|
|
"recipe.privacy1st.de" = {};
|
|
"traggo.privacy1st.de" = {};
|
|
};
|
|
hdd-subvolumes = {
|
|
"cloud.privacy1st.de" = {};
|
|
# MediaKollektiv: 796 GiB
|
|
"cloud.media-kollektiv.eu" = {};
|
|
};
|
|
preserve-hourly = "24h 7d 4w 6m";
|
|
preserve-daily = "7d 4w 6m";
|
|
in
|
|
{
|
|
services.btrbk = {
|
|
extraPackages = [ pkgs.lz4 ];
|
|
# Lowest scheduling priority.
|
|
niceness = 19;
|
|
# Set of btrbk instances. The instance named btrbk is the default one.
|
|
instances = {
|
|
|
|
"local-snapshot" = {
|
|
onCalendar = "hourly";
|
|
#onCalendar = "*:0/15"; # Every 15min
|
|
|
|
settings = {
|
|
timestamp_format = "long";
|
|
#stream_compress = "lz4";
|
|
|
|
snapshot_preserve_min = "2d";
|
|
snapshot_preserve = preserve-hourly;
|
|
|
|
volume."/jc-data" = {
|
|
snapshot_dir = "/snap";
|
|
subvolume = ssd-subvolumes;
|
|
};
|
|
volume."/mnt/data/jc-data" = {
|
|
snapshot_dir = "/mnt/data/snap2";
|
|
subvolume = hdd-subvolumes;
|
|
};
|
|
};
|
|
};
|
|
|
|
"local-backup" = {
|
|
# Run daily, 5 minutes after `local-snapshot` 0'o'clock timer.
|
|
onCalendar = "00:05";
|
|
|
|
settings = {
|
|
timestamp_format = "long";
|
|
#stream_compress = "lz4";
|
|
|
|
# Create backups.
|
|
target_preserve_min = "no";
|
|
target_preserve = preserve-daily;
|
|
|
|
# Don't create or delete snapshots.
|
|
snapshot_preserve_min = "all";
|
|
snapshot_create = "no";
|
|
|
|
volume."/jc-data" = {
|
|
snapshot_dir = "/snap";
|
|
target = "/mnt/backup/snap";
|
|
subvolume = ssd-subvolumes;
|
|
};
|
|
volume."/mnt/data/jc-data" = {
|
|
snapshot_dir = "/mnt/data/snap2";
|
|
target = "/mnt/backup/snap2";
|
|
subvolume = hdd-subvolumes;
|
|
};
|
|
};
|
|
};
|
|
|
|
};
|
|
};
|
|
}
|