2023-07-30 19:41:51 +02:00
|
|
|
{ config, pkgs, ... }:
|
2023-04-12 22:09:37 +02:00
|
|
|
{
|
2023-11-16 14:40:40 +01:00
|
|
|
age.secrets."borg/passphrase" = {
|
|
|
|
file = ../../../../secrets/nuc/borg/passphrase.age;
|
|
|
|
};
|
2023-07-30 19:41:51 +02:00
|
|
|
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
|
|
|
source_directories = [
|
2023-07-30 19:41:51 +02:00
|
|
|
"/var/lib"
|
|
|
|
"/var/log"
|
|
|
|
"/nix/persist"
|
|
|
|
];
|
2024-05-13 11:59:14 +02:00
|
|
|
# don't backup these for now
|
|
|
|
exclude_patterns = [
|
|
|
|
"/var/lib/movies"
|
|
|
|
"/var/lib/shows"
|
|
|
|
];
|
2023-10-15 16:30:40 +02:00
|
|
|
repositories = [
|
|
|
|
{
|
|
|
|
label = "nuc";
|
|
|
|
path = "/mnt/backup/nuc";
|
|
|
|
}
|
2023-07-30 19:41:51 +02:00
|
|
|
];
|
2023-11-16 14:40:40 +01:00
|
|
|
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets."borg/passphrase".path}";
|
2023-10-28 15:51:25 +02:00
|
|
|
compression = "lz4";
|
2023-10-29 11:58:56 +01:00
|
|
|
keep_daily = 7;
|
|
|
|
keep_weekly = 4;
|
|
|
|
keep_monthly = 12;
|
|
|
|
keep_yearly = 3;
|
2023-04-24 22:11:57 +02:00
|
|
|
};
|
2023-04-12 22:09:37 +02:00
|
|
|
};
|
|
|
|
}
|