# 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, ... }:
{
  imports = [
    ./snapshot.nix
    ./backup.nix
  ];

  services.btrbk = {
    # Lowest scheduling priority.
    niceness = 19;
    # The `instances` option is set by `./snapshot.nix` and `./backup.nix`.
  };
}
