nixfiles/hosts/hetzner-arm/containers/vault-ca/profiles/restic.nix

35 lines
909 B
Nix
Raw Normal View History

{
2024-03-09 22:18:26 +00:00
self,
pkgs,
config,
...
}: let
2024-03-09 22:18:26 +00:00
backupSchedules = import "${self}/data/backupSchedules.nix";
2024-05-24 18:58:21 +01:00
inherit (config.services.secrets) secrets;
in {
2024-05-24 18:58:21 +01:00
environment.systemPackages = with pkgs; [
restic
(pkgs.writeShellScriptBin "restic-vault" ''
env \
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
$(cat ${secrets.restic_env.path}) \
${pkgs.restic}/bin/restic $@
'')
];
services.restic.backups.vault = {
user = "root";
paths = [
"/var/lib/vault"
"/var/lib/private/step-ca"
];
2024-03-09 22:18:26 +00:00
timerConfig = backupSchedules.restic.high;
2024-05-24 18:58:21 +01:00
# 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/Vault";
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
};
}