summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Stachurski <j.stachurski@student.utwente.nl>2025-05-03 01:07:12 +0200
committerJakub Stachurski <j.stachurski@student.utwente.nl>2025-05-03 01:07:27 +0200
commit57dde93d6059cd476bc5e196e0cef348f6544085 (patch)
tree1c01610d0de9008ebc6f84276a3d055ec999ba42
parent162a78d224af35e3261e106d516069f06a657880 (diff)
btrbk setup
-rw-r--r--nixos/hosts/apocalypse/backup.nix30
-rw-r--r--nixos/hosts/apocalypse/hardware-configuration.nix10
2 files changed, 38 insertions, 2 deletions
diff --git a/nixos/hosts/apocalypse/backup.nix b/nixos/hosts/apocalypse/backup.nix
new file mode 100644
index 0000000..de22bd3
--- /dev/null
+++ b/nixos/hosts/apocalypse/backup.nix
@@ -0,0 +1,30 @@
+{ config, lib, pkgs, modulesPath, ...}:
+{
+ services.btrbk = {
+ instances."remote_vault" = {
+ onCalendar = "weekly";
+ settings = {
+ ssh_identity = "/etc/btrbk_key"; # NOTE: must be readable by user/group btrbk
+ ssh_user = "vault";
+ stream_compress = "lz4";
+ volume."/btrfs_root" = {
+ target = "ssh://10.100.0.1/vault/backups/apocalypse";
+ subvolume = {
+ nixos = {
+ snapshot_create = "always";
+ };
+ };
+ # "nixos" could instead be an attribute set with other volumes to
+ # back up and to give subvolume specific configuration.
+ # See man btrbk.conf for possible options.
+ /*
+ subvolume = {
+ home = { snapshot_create = "always"; };
+ nixos = {};
+ };
+ */
+ };
+ };
+ };
+};
+}
diff --git a/nixos/hosts/apocalypse/hardware-configuration.nix b/nixos/hosts/apocalypse/hardware-configuration.nix
index f611cd6..1133dc6 100644
--- a/nixos/hosts/apocalypse/hardware-configuration.nix
+++ b/nixos/hosts/apocalypse/hardware-configuration.nix
@@ -28,14 +28,20 @@ menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' {
fileSystems."/" =
{ device = "/dev/mapper/cryptroot";
fsType = "btrfs";
- options = [ "subvol=@root" ];
+ options = [ "subvol=@root" "compress=zstd" ];
};
+ fileSystems."/btrfs_root" = {
+ device = "/dev/mapper/cryptroot";
+ fsType = "btrfs"
+ options = [ "subvolid=5", "compress=zstd"]
+ };
+
fileSystems."/snapshots" =
{ device = "/dev/mapper/cryptroot";
fsType = "btrfs";
- options = [ "subvol=@snapshots" ];
+ options = [ "subvol=@snapshots" "compress=zstd" ];
};
fileSystems."/boot" =