1
0
Fork 0
selfhostblocks/modules/contracts/backup/docs/default.md
2024-08-20 14:33:13 +00:00

1.6 KiB

Backup Contract

This NixOS contract represents a backup job that will backup one or more files or directories at a regular schedule.

Contract Reference

These are all the options that are expected to exist for this contract to be respected.

id-prefix: contracts-backup-options-
list-id: selfhostblocks-options
source: @OPTIONS_JSON@

Usage

A service that can be backed up will provide a backup option, like for the Vaultwarden service. What this option defines is an implementation detail of that service but it will at least define what directories to backup and possibly hooks to run before or after the backup job runs.

shb.<service>.backup

Let's assume a module implementing this contract is available under the shb.<backup_impl> variable. Then, to actually backup the service, one would write:

shb.<backup_impl>.instances."<service>" = shb.<service>.backup // {
  enable = true;

  # Options specific to backup_impl
};

Then, for extra caution, a second backup could be made using another module shb.<backup_impl_2>:

shb.<backup_impl_2>.instances."<service>" = shb.<service>.backup // {
  enable = true;

  # Options specific to backup_impl_2
};

Provided Implementations

One implementation is provided out of the box:

A second one based on borgbackup is in progress.