feat: btrbk

This commit is contained in:
Julien Hémono 2024-10-21 11:58:36 +02:00
parent fcc7c22739
commit eab0bd8d10
3 changed files with 39 additions and 2 deletions

29
hosts/gwiad/btrbk.nix Normal file
View file

@ -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";
};
};
};
};
};
}

View file

@ -8,6 +8,8 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# Services
./btrbk.nix
];
# Boot configuration

View file

@ -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";