Restic: Difference between revisions
VTimofeenko (talk | contribs) Expand intro and add configuration options |
→Restic: Add a reference to the backups.<name>.createWrapper option |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[https://restic.net/ Restic] is a fast and secure backup program. NixOS packages both <code>restic</code> client (program used to make backups) and <code>restic-rest-server</code> (one of the backends to store the backups remotely, " | [https://restic.net/ Restic] is a fast and secure backup program. NixOS packages both <code>restic</code> client (program used to make backups) and <code>restic-rest-server</code> (one of the backends to store the backups remotely, "repositories" in restic parlance). | ||
== Installing == | == Installing == | ||
Line 14: | Line 14: | ||
=== Restic === | === Restic === | ||
NixOS provides options to create a systemd timer and a service that will create the backups. See [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=services.restic.backups services.restic.backups options]. | NixOS provides options to create a systemd timer and a service that will create the backups. See [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=services.restic.backups services.restic.backups options] and "[https://restic.readthedocs.io/en/stable/040_backup.html Backing up]" in the restic documentation. | ||
Note that NixOS includes an option to automatically create the repository by specifying <code>services.restic.backups.<name>.initialize = true;</code>, as well as a wrapper to run restic in the same environment as the systemd jobs in <code>services.restic.backups.<name>.createWrapper</code> | |||
=== Restic Rest Server === | === Restic Rest Server === | ||
Line 38: | Line 40: | ||
}; | }; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Note that you will have to set your Restic configuration to use the wrapper using the [https://search.nixos.org/options?channel=unstable&show=services.restic.backups.%3Cname%3E.package&from=0&size=50&sort=relevance&type=packages&query=services.restic.backups services.restic.backups.<name>.package] option, for example <ref>https://github.com/NixOS/nixpkgs/issues/341999#issuecomment-2558504576</ref>, | |||
<syntaxHighlight lang=nix> | |||
services.restic.backups.foo = { | |||
# ... | |||
user = "restic"; | |||
package = pkgs.writeShellScriptBin "restic" '' | |||
exec /run/wrappers/bin/restic "$@" | |||
''; | |||
}; | |||
</syntaxHighlight> | |||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Backup]] | [[Category:Backup]] |