dotfiles/modules/nixos/homelab/restic/resticEris/default.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

{
config,
flake,
...
}:
let
inherit (flake.config.machines.devices) eris;
inherit (flake.config.people) user0;
envFile = "backblaze/${eris.name}-env";
repoFile = "backblaze/${eris.name}-repo";
passFile = "restic/${eris.name}-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 = [
"/home/${user0}/.ssh"
"/mnt/storage"
];
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
}