From a5d7ad513f771cd02b130912423bf488d8f66386 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 29 Sep 2025 10:56:29 +0200 Subject: module/backups: Persist restic cache directory This avoids having to wait for restic to rebuild the cache on every run. --- modules/by-name/ba/backup/module.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/by-name/ba/backup/module.nix b/modules/by-name/ba/backup/module.nix index d0805092..7a788764 100644 --- a/modules/by-name/ba/backup/module.nix +++ b/modules/by-name/ba/backup/module.nix @@ -11,6 +11,7 @@ lib, config, pkgs, + libraries, ... }: let cfg = config.soispha.services.backup; @@ -18,6 +19,8 @@ snapshotDir = "/srv/last_snapshot"; in { options.soispha.services.backup = { + enable = libraries.base.options.mkEnable "backups via restic"; + storagebox = { enable = lib.mkEnableOption "remote backups"; user = lib.mkOption { @@ -56,7 +59,16 @@ in { }; }; - config = { + config = lib.mkIf cfg.enable { + soispha.impermanence.directories = lib.mkMerge [ + (lib.mkIf cfg.storagebox.enable [ + "/var/cache/restic-backups-storagebox" + ]) + (lib.mkIf cfg.local.enable [ + "/var/cache/restic-backups-local" + ]) + ]; + age.secrets = { resticStorageboxSshKey = lib.mkIf cfg.storagebox.enable { file = cfg.storagebox.sshKey; -- cgit 1.4.1