nixfiles/hosts/vault/profiles/restic.nix

30 lines
720 B
Nix
Raw Normal View History

{
pkgs,
config,
...
}: let
secrets = config.services.secrets.secrets;
in {
services.restic.backups.vault = {
user = "root";
2023-09-30 16:49:52 +01:00
paths = ["/var/lib/vault"];
timerConfig = {
OnBootSec = "1m";
2023-09-30 16:49:52 +01:00
OnCalendar = "6h";
};
# env contains fixed repository with auth
repository = "rest:https://storage-restic.owo.monster/Vault";
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
};
environment.systemPackages = [
(pkgs.writeShellScriptBin "restic-vault" ''
env \
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
$(cat ${secrets.restic_env.path}) \
${pkgs.restic}/bin/restic $@
'')
];
}