dotfiles/modules/nixos/services/restic/default.nix

66 lines
1.5 KiB
Nix
Raw Normal View History

2025-11-22 03:14:50 -06:00
{
config,
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
envFile = "backblaze/env";
repoFile = "backblaze/repo";
passFile = "restic/pass";
2025-11-22 03:14:50 -06:00
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;
};
2025-11-26 22:34:04 -06:00
paths =
let
inst = instance: instances.${instance}.mntPaths.path0;
2025-11-26 22:34:04 -06:00
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")
2025-11-26 22:34:04 -06:00
];
2025-11-22 03:14:50 -06:00
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
}