nixfiles/hosts/hetzner-arm/containers/jellyfin/profiles/restic.nix

36 lines
924 B
Nix

{
self,
pkgs,
config,
...
}: let
inherit (config.services.secrets) secrets;
backupSchedules = import "${self}/data/backupSchedules.nix";
in {
environment.systemPackages = with pkgs; [
restic
(pkgs.writeShellScriptBin "restic-jellyfin" ''
env \
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
$(cat ${secrets.restic_env.path}) \
${pkgs.restic}/bin/restic $@
'')
];
services.restic.backups.jellyfin = {
user = "root";
paths = [
"/var/lib/jellyfin"
];
# repository is overrided in environmentFile to contain auth
# make sure to keep up to date when changing repository
repository = "rest:https://storage-restic.owo.monster/Jellyfin";
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
pruneOpts = ["--keep-last 10"];
timerConfig = backupSchedules.restic.low;
};
}