Skip to content

borgbackup 🔹

Efficient, deduplicating backup program with optional compression and secure encryption.

Categories

System

BorgBackup (short: Borg) gives you:

  • Space efficient storage of backups.
  • Secure, authenticated encryption.
  • Compression: lz4, zstd, zlib, lzma or none.
  • Mountable backups with FUSE.
  • Easy installation on multiple platforms: Linux, macOS, BSD, …
  • Free software (BSD license).
  • Backed by a large and active open-source community.

Usage via Inventory

Roles

This module can be used via predefined roles

- `client`
- `server`

Every role has its own configuration options. Which are each listed below.

For more information, see the inventory guide.

Example

For example the admin module adds the following options globally to all machines where it is used.

clan.admin.allowedkeys

This means there are two equivalent ways to set the allowedkeys option. Either via a nixos module or via the inventory interface. But it is recommended to keep together imports and config to preserve locality of the module configuration.

clan-core.lib.buildClan {
    inventory.services = {
        admin.me = {
            roles.default.machines = [ "jon" ];
            config.allowedkeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD..." ];
        };
    };
};
clan-core.lib.buildClan {
    machines = {
        jon = {
            clan.admin.allowedkeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD..." ];
            imports = [ clanModules.admin ];
        };
    };
};

Options of client role

The following options are available when using the client role.

clan.borgbackup.destinations

destinations where the machine should be backuped to

Type: attribute set of (submodule)

Default:

{ }

client.nix

clan.borgbackup.destinations.<name>.name

the name of the backup job

Type: string matching the pattern ^[a-zA-Z0-9._-]+$

Default:

"‹name›"

client.nix

clan.borgbackup.destinations.<name>.repo

the borgbackup repository to backup to

Type: string

client.nix

clan.borgbackup.destinations.<name>.rsh

the rsh to use for the backup

Type: string

Default:

"ssh -i \${config.clan.core.facts.services.borgbackup.secret.\"borgbackup.ssh\".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"

client.nix

clan.borgbackup.exclude

Directories/Files to exclude from the backup. Use * as a wildcard.

Type: list of string

Default:

[ ]
Example
[
  "*.pyc"
]

client.nix

Options of server role

The borgbackup server doesnt offer / require any options to be set.

Usage via Nix

This module can be also imported directly in your nixos configuration. Although it is recommended to use the inventory interface if available.

Some modules are considered 'low-level' or 'expert modules' and are not available via the inventory interface.

{config, lib, inputs, ...}: {
    imports = [ inputs.clan-core.clanModules.borgbackup ];
    # ...
}

Module Options

The following options are available for this module.

clan.borgbackup.destinations

destinations where the machine should be backuped to

Type: attribute set of (submodule)

Default:

{ }

client.nix

clan.borgbackup.destinations.<name>.name

the name of the backup job

Type: string matching the pattern ^[a-zA-Z0-9._-]+$

Default:

"‹name›"

client.nix

clan.borgbackup.destinations.<name>.repo

the borgbackup repository to backup to

Type: string

client.nix

clan.borgbackup.destinations.<name>.rsh

the rsh to use for the backup

Type: string

Default:

"ssh -i \${config.clan.core.facts.services.borgbackup.secret.\"borgbackup.ssh\".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"

client.nix

clan.borgbackup.exclude

Directories/Files to exclude from the backup. Use * as a wildcard.

Type: list of string

Default:

[ ]
Example
[
  "*.pyc"
]

client.nix