diff --git a/firestar/btrbk.nix b/firestar/btrbk.nix new file mode 100644 index 0000000..00e54dd --- /dev/null +++ b/firestar/btrbk.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: + +let + volumeConfig = (subvolumes: { + snapshot_dir = "@snapshots"; + subvolume = builtins.foldl' + (acc: subvol: acc // { + ${subvol} = { }; + }) + { } + subvolumes; + }); +in +{ + services.btrbk = { + sshAccess = [ + { + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTqU3EvTgY5/e9m6YyQWypQPK58t9iPmPnPYAvnODGB asonix@lionheart"; + roles = [ "source" "info" "send" ]; + } + ]; + extraPackages = with pkgs; [ gzip ]; + instances.btrbk = { + onCalendar = "hourly"; + settings = { + snapshot_preserve_min = "2d"; + snapshot_preserve = "7d 5w"; + transaction_log = "/var/log/btrbk.log"; + volume = { + "/btrfs/hdd" = volumeConfig [ + "@documents" + "@downloads" + "@music" + "@pictures" + "@videos" + ]; + "/btrfs/nvme" = volumeConfig [ "@development" ]; + }; + }; + }; + }; +} diff --git a/firestar/default.nix b/firestar/default.nix index c84e37c..b8fab95 100644 --- a/firestar/default.nix +++ b/firestar/default.nix @@ -8,6 +8,7 @@ imports = [ # Include the results of the hardware scan. + ./btrbk.nix ./hardware-configuration.nix ./wireguard.nix ];