# For each instance, a service and timer will be created: # systemctl list-unit-files | grep btrbk # #=> btrbk-.service # #=> btrbk-.timer # # If onCalendar is set to `null`, one can manually execute btrbk with # sudo systemctl start btrbk-.service # Print generated systemd unit file # cat "$(systemctl show -P FragmentPath btrbk-.service)" # #=> ExecStart=/nix/store/53nvbl1c0w14524j7v3fpn9py31yi2hb-btrbk-0.32.6/bin/btrbk -c /etc/btrbk/local-backup.conf run { config, pkgs, ... }: { imports = [ ./snapshot.nix ./backup.nix ]; # Compression # # `btrbk` can be configured to either # - compress the BTRFS data stream itself # - or to enable SSH compression # # The latter supports only ZLIB (LZ77) compression, see https://www.ietf.org/rfc/rfc4253.txt # Thus, we choose the first option instead. # # lz4 is a good option, but zstd-9 seems to be better in the mean time. # # Install the compression package so that other hosts can pull compressed snapshots from us. environment.systemPackages = [ pkgs.zstd ]; services.btrbk = { # Lowest scheduling priority. niceness = 19; # The `instances` option is set by `./snapshot.nix` and `./backup.nix`. }; }