✨ 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.
REST server (server.nix)
Section titled “REST server (server.nix)”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.
Metrics (metrics.nix)
Section titled “Metrics (metrics.nix)”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.
Options
Section titled “Options”- enable
boolEnable restic backup client - enableDryRun
boolDry Run mode - enableWaitRemoteFs
boolRun backups only after remote-fs.target - enableServer
boolEnable restic REST server - listenAll
boolBind the REST server on 0.0.0.0 (off-site clients) - serverDataDir
strLocal storage root of the REST server (all hosts’ repos) - targets
listOf submoduleBackup destinations for this host (local path or REST URL)- name
strTarget id, used in backup/unit names (<category>-<name>) - root
strRepository root: local path or REST URL - zone
strZone selecting the repo passphrase (restic-password-<zone>) - categories
listOf ( enum [ "system" "nfs" "medias" ] )What to back up to this target
- name
- nfsPaths
listOf strNFS dirs (/srv/nfs/<xxx>) included in the ‘nfs’ category - mediasPaths
listOf strMedias dirs (/srv/medias/<xxx>) included in the ‘medias’ category - shared
rawRestic values shared with therestic/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 🡕