Restic

From NixOS Wiki

Restic is a fast and secure backup program.

Installing

Add restic to environment.systemPackages like so:

environment.systemPackages = with pkgs; [
  restic
];

Security Wrapper

If you want to back up your system without running restic as root, you can create a user and security wrapper to give restic the capability to read anything on the filesystem as if it were running as root. The following will create the wrapper at /run/wrappers/bin/restic

users.users.restic = {
  isNormalUser = true;
};

security.wrappers.restic = {
  source = "${pkgs.restic.out}/bin/restic";
  owner = "restic";
  group = "users";
  permissions = "u=rwx,g=,o=";
  capabilities = "cap_dac_read_search=+ep";
};