add restic backups to s3 for immich

This commit is contained in:
Noah Masur
2024-12-12 15:11:35 +00:00
parent 66ef1fa38d
commit b691895e05
5 changed files with 69 additions and 0 deletions

View File

@ -22,6 +22,11 @@
description = "S3 access key ID for backups";
default = null;
};
glacierBucket = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "S3 bucket for glacier backups";
default = null;
};
};
};
@ -69,5 +74,30 @@
# timerConfig = { OnCalendar = "00:05:00"; };
# environmentFile = backup.s3File;
# };
secrets.s3-glacier = {
source = ../../../private/s3-glacier.age;
dest = "${config.secretsDirectory}/s3-glacier";
};
secrets.restic = {
source = ../../../private/restic.age;
dest = "${config.secretsDirectory}/restic";
};
services.restic.backups = {
default = {
repository = "s3:s3.us-east-1.amazonaws.com/${config.backup.s3.glacierBucket}/restic";
paths = [ "/data/images" ];
environmentFile = config.secrets.s3-glacier.dest;
passwordFile = config.secrets.restic.dest;
pruneOpts = [
"--keep-daily 14"
"--keep-weekly 6"
"--keep-monthly 12"
"--keep-yearly 100"
];
};
};
};
}

View File

@ -40,6 +40,9 @@
# Point localhost to the local domain
networking.hosts."127.0.0.1" = [ config.hostnames.photos ];
# Backups
services.restic.backups.default.paths = [ "/data/images" ];
};
}