mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2025-04-25 16:08:30 +02:00
configured backups
This commit is contained in:
parent
60e1f3c3d0
commit
b48fa4e383
25 changed files with 217 additions and 92 deletions
|
@ -1,37 +1,35 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
sops.secrets."borg/passphrase" = { };
|
||||
environment.systemPackages = [ pkgs.borgbackup ];
|
||||
fileSystems."/mnt/backup" =
|
||||
{
|
||||
device = "/dev/disk/by-uuid/f6905cdb-c130-465a-90a3-93997023b5d3 ";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd" "noatime" "nofail" ];
|
||||
device = "dev/disk/by-uuid/74e78699-fe27-4467-a9bb-99fc6e8d52c5";
|
||||
fsType = "ext4";
|
||||
options = [ "nofail" ];
|
||||
neededForBoot = false;
|
||||
};
|
||||
services.borgmatic = {
|
||||
enable = true;
|
||||
settings = {
|
||||
location.source_directories = [
|
||||
"/var/lib"
|
||||
"/var/log"
|
||||
"/nix/persist"
|
||||
];
|
||||
location.repositories = [
|
||||
"/mnt/backup/nuc"
|
||||
];
|
||||
storage = {
|
||||
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.sops.secrets."borg/passphrase".path}";
|
||||
compression = "lz4";
|
||||
};
|
||||
retention = {
|
||||
keep_daily = 7;
|
||||
keep_weekly = 4;
|
||||
keep_monthly = 12;
|
||||
keep_yearly = 3;
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue