From e9c5f1c10175e0caef6daf5fc7f4dca67da5618f Mon Sep 17 00:00:00 2001 From: hexchen Date: Wed, 21 Apr 2021 13:49:27 +0000 Subject: [PATCH] services: init restic backup activate on all relevant hosts --- hosts/athame/nixos/default.nix | 1 + hosts/samhain/nixos/default.nix | 1 + hosts/yule/nixos/default.nix | 1 + services/restic.nix | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 services/restic.nix diff --git a/hosts/athame/nixos/default.nix b/hosts/athame/nixos/default.nix index dc7e5374..5b9a5159 100644 --- a/hosts/athame/nixos/default.nix +++ b/hosts/athame/nixos/default.nix @@ -21,6 +21,7 @@ ../../../services/murmur.nix ../../../services/znc.nix ../../../services/matrix.nix + ../../../services/restic.nix ]; boot.loader.grub.enable = true; diff --git a/hosts/samhain/nixos/default.nix b/hosts/samhain/nixos/default.nix index b6535429..1118bb3d 100644 --- a/hosts/samhain/nixos/default.nix +++ b/hosts/samhain/nixos/default.nix @@ -7,6 +7,7 @@ profiles.sway profiles.kat ../../../services/zfs.nix + ../../../services/restic.nix ../../../services/nginx.nix ./thermal ./vm diff --git a/hosts/yule/nixos/default.nix b/hosts/yule/nixos/default.nix index e71db011..9040c031 100644 --- a/hosts/yule/nixos/default.nix +++ b/hosts/yule/nixos/default.nix @@ -4,6 +4,7 @@ imports = [ ./hw.nix ../../../services/zfs.nix + ../../../services/restic.nix profiles.gui profiles.sway profiles.kat diff --git a/services/restic.nix b/services/restic.nix new file mode 100644 index 00000000..3d8a7097 --- /dev/null +++ b/services/restic.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +{ + services.restic.backups.tardis = { + passwordFile = "/etc/restic/system"; + paths = [ + "/home" + "/var/lib" + ]; + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 5" + "--keep-monthly 12" + ]; + repository = ""; + }; + systemd.services."restic-backups-tardis".environment.RESTIC_REPOSITORY_FILE = "/etc/restic/system.repo"; + + services.postgresqlBackup = { + enable = config.service.postgresql.enable; + backupAll = true; + startAt = "*-*-* 23:45:00"; + }; +}