Skip to content

✨ darkone.service.restic

Restic backup module: REST server + per-host backup targets.

Example (machine config):

darkone.service.restic = {
enable = true;
targets = [
{ name = "main"; root = "rest:http://restic.my-zone.my-domain.tld:8888";
zone = "ag"; categories = [ "system" "nfs" ]; }
];
};

Repository layout per target: one repo per category, named after it.

<root>/<hostname>/system <- "system" category (/ minus excludes)
<root>/<hostname>/nfs <- "nfs" category (/srv/nfs/<...>)
<root>/<hostname>/medias <- "medias" category (/srv/medias/<...>)

Sub-modules (restic/):

  • server.nix: the REST server, one account per fleet host;
  • metrics.nix: backup freshness metrics for the restic alerts.

One account per fleet host (restic/<hostname>/rest-password), checked against an htpasswd assembled at boot; privateRepos confines each host to its own <hostname>/ prefix.

Monitored nodes only (monitoring-node feature): each job stamps its last success in the textfile collector, and restic-declared lists the declared jobs so a job that never succeeds still ages into a dnf-restic-<zone> alert.

  • enable bool Enable restic backup client
  • enableDryRun bool Dry Run mode
  • enableWaitRemoteFs bool Run backups only after remote-fs.target
  • enableServer bool Enable restic REST server
  • listenAll bool Bind the REST server on 0.0.0.0 (off-site clients)
  • serverDataDir str Local storage root of the REST server (all hosts’ repos)
  • targets listOf submodule Backup destinations for this host (local path or REST URL)
    • name str Target id, used in backup/unit names (<category>-<name>)
    • root str Repository root: local path or REST URL
    • zone str Zone selecting the repo passphrase (restic-password-<zone>)
    • categories listOf ( enum [ "system" "nfs" "medias" ] ) What to back up to this target
  • nfsPaths listOf str NFS dirs (/srv/nfs/<xxx>) included in the ‘nfs’ category
  • mediasPaths listOf str Medias dirs (/srv/medias/<xxx>) included in the ‘medias’ category
  • shared raw Restic values shared with the restic/ sub-modules.
darkone.service.restic = {
enable = false;
enableDryRun = false;
enableWaitRemoteFs = false;
enableServer = false;
listenAll = false;
serverDataDir = "/mnt/backup/restic";
targets = [ ];
targets.name = "main";
targets.root = "rest:http://restic.${zone.domain}:${toString srvPort}";
targets.zone = zone.name;
targets.categories = [ ];
nfsPaths = [ ];
mediasPaths = [ ];
shared = { inherit params; };
};

Source: modules/service/restic.nix 🡕