nixos-config/hosts/nuc/modules/backup/default.nix

42 lines
946 B
Nix
Raw Normal View History

2023-07-30 19:41:51 +02:00
{ config, pkgs, ... }:
2023-04-12 22:09:37 +02:00
{
2023-07-30 19:41:51 +02:00
sops.secrets."borg/passphrase" = { };
environment.systemPackages = [ pkgs.borgbackup ];
2023-04-12 22:09:37 +02:00
fileSystems."/mnt/backup" =
{
2023-07-31 14:12:10 +02:00
device = "/dev/disk/by-uuid/74e78699-fe27-4467-a9bb-99fc6e8d52c5";
2023-07-30 19:41:51 +02:00
fsType = "ext4";
options = [ "nofail" ];
2023-04-12 22:09:37 +02:00
neededForBoot = false;
};
2023-07-30 19:41:51 +02:00
services.borgmatic = {
enable = true;
settings = {
2023-10-15 16:30:40 +02:00
# fix failing check
location = null;
source_directories = [
2023-07-30 19:41:51 +02:00
"/var/lib"
"/var/log"
"/nix/persist"
];
2023-10-15 16:30:40 +02:00
repositories = [
{
label = "nuc";
path = "/mnt/backup/nuc";
}
2023-07-30 19:41:51 +02:00
];
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;
2023-04-12 22:09:37 +02:00
};
};
2023-04-12 22:09:37 +02:00
};
}