From d8f9425bed41cd748902f3ee2ec31923bfadd29c Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Wed, 12 Apr 2023 22:09:37 +0200 Subject: [PATCH] configured backups for the nuc --- hosts/nuc/default.nix | 1 + hosts/nuc/modules/backup/default.nix | 39 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 hosts/nuc/modules/backup/default.nix diff --git a/hosts/nuc/default.nix b/hosts/nuc/default.nix index b85e83a..99a8989 100644 --- a/hosts/nuc/default.nix +++ b/hosts/nuc/default.nix @@ -6,6 +6,7 @@ # Include the results of the hardware scan. ./hardware-configuration.nix ./modules/networks + ./modules/backup ./modules/nextcloud ./modules/vaultwarden ./modules/nginx diff --git a/hosts/nuc/modules/backup/default.nix b/hosts/nuc/modules/backup/default.nix new file mode 100644 index 0000000..fa7ddc3 --- /dev/null +++ b/hosts/nuc/modules/backup/default.nix @@ -0,0 +1,39 @@ + +{ + fileSystems."/mnt/backup" = + { + device = "/dev/disk/by-uuid/f6905cdb-c130-465a-90a3-93997023b5d3 "; + fsType = "btrfs"; + options = [ "compress=zstd" "noatime" ]; + neededForBoot = false; + }; + + fileSystems."/mnt/pool" = + { + device = "/dev/disk/by-uuid/16b0bd14-1b07-477d-a20d-982f9467f6df"; + fsType = "btrfs"; + options = [ "compress=zstd" "noatime" ]; + }; + + services.btrbk = { + instances."nuc-to-disk".settings = { + snapshot_preserve = "14d"; + snapshot_preserve_min = "2d"; + target_preserve = "30d 4w 12m"; + target_preserve_min = "2d"; + volume = { + "/mnt/pool" = { + subvolume = { + log = { + snapshot_create = "always"; + }; + lib = { + snapshot_create = "always"; + }; + }; + target = "/mnt/backup/nuc"; + }; + }; + }; + }; +}