diff --git a/hosts/gwiad/btrbk.nix b/hosts/gwiad/btrbk.nix new file mode 100644 index 0000000..1f7f3cd --- /dev/null +++ b/hosts/gwiad/btrbk.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +{ + services.btrbk = { + instances.btrbk = { + onCalendar = "hourly"; + settings = { + snapshot_dir = "@snapshots"; + snapshot_create = "onchange"; + incremental = "strict"; + snapshot_preserve_min = "2d"; + snapshot_preserve = "7d"; + target_preserve_min = "3d"; + target_preserve = "20d"; + timestamp_format = "long-iso"; + volume."/btr_pool" = { + target = "/run/media/jhemono/Gwiad PHD/Backup"; + subvolume = { + "@home" = { + snapshot_name = "home"; + target_preserve = "20d 15w *m"; + }; + "@var".snapshot_name = "var"; + }; + }; + }; + }; + }; +} diff --git a/hosts/gwiad/configuration.nix b/hosts/gwiad/configuration.nix index abf3e54..7dfcab7 100644 --- a/hosts/gwiad/configuration.nix +++ b/hosts/gwiad/configuration.nix @@ -8,6 +8,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # Services + ./btrbk.nix ]; # Boot configuration diff --git a/hosts/gwiad/hardware-configuration.nix b/hosts/gwiad/hardware-configuration.nix index e8dadd8..0578af1 100644 --- a/hosts/gwiad/hardware-configuration.nix +++ b/hosts/gwiad/hardware-configuration.nix @@ -13,14 +13,20 @@ boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; + boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/698c62d9-1115-4756-b812-1daae4898b83"; + + fileSystems."/btr_pool" = + { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; + fsType = "btrfs"; + options = [ "subvolid=5" ]; + }; + fileSystems."/" = { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; fsType = "btrfs"; options = [ "subvol=@" ]; }; - boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/698c62d9-1115-4756-b812-1daae4898b83"; - fileSystems."/home" = { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; fsType = "btrfs";