From d6586af31366b52f01cd8ccbb58e8be9d7c07df5 Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Tue, 27 Jun 2023 23:08:41 +0300 Subject: [PATCH] add restic backup on vps --- machines/NixOS-VPS/default.nix | 1 + machines/NixOS-VPS/services/backups.nix | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 machines/NixOS-VPS/services/backups.nix diff --git a/machines/NixOS-VPS/default.nix b/machines/NixOS-VPS/default.nix index 4ee8ad4..db45f97 100644 --- a/machines/NixOS-VPS/default.nix +++ b/machines/NixOS-VPS/default.nix @@ -7,6 +7,7 @@ ./hardware ./network.nix ./nix.nix + ./services/backups.nix ./services/dns.nix ./services/tor-bridge.nix ./services/wireguard.nix diff --git a/machines/NixOS-VPS/services/backups.nix b/machines/NixOS-VPS/services/backups.nix new file mode 100644 index 0000000..9379539 --- /dev/null +++ b/machines/NixOS-VPS/services/backups.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: { + services.restic.backups.vps-data = { + initialize = true; + passwordFile = "/srv/restic-pass"; + repositoryFile = "/srv/restic-repo"; + paths = [ "/srv" ]; + exclude = [ "/srv/restic-pass" "/srv/restic-repo" ]; + environmentFile = "${pkgs.writeText "restic.env" "GOMAXPROCS=1"}"; + extraBackupArgs = [ "--no-scan" ]; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 5" + "--keep-yearly 2" + ]; + }; +} \ No newline at end of file