{ config, flake, pkgs, ... }: let inherit (flake.config.services) instances; inherit (flake.config.people) user0; envFile = "backblaze/env"; repoFile = "backblaze/repo"; passFile = "restic/pass"; in { services.restic = { backups = { remote = { environmentFile = config.sops.secrets.${envFile}.path; initialize = true; passwordFile = config.sops.secrets.${passFile}.path; repositoryFile = config.sops.secrets.${repoFile}.path; timerConfig = { OnCalendar = "0/4:00"; Persistent = true; }; paths = let inst = instance: instances.${instance}.mntPaths.path0; in [ "/home/${user0}/.ssh" (inst "firefly-iii") (inst "forgejo") (inst "mastodon") (inst "opencloud") (inst "minecraft0") (inst "minecraft1") (inst "vaultwarden") ((inst "jellyfin") + "/cache") ((inst "jellyfin") + "/data") ((inst "jellyfin") + "/media/music") ]; }; }; }; sops = { secrets = builtins.listToAttrs ( map (secret: { name = secret; value = { path = "/run/secrets/${secret}"; owner = "root"; group = "root"; mode = "0600"; }; }) [ envFile repoFile passFile ] ); }; }