diff --git a/modules/backups/default.nix b/modules/backups/default.nix index 6bfc657..5993270 100644 --- a/modules/backups/default.nix +++ b/modules/backups/default.nix @@ -21,6 +21,11 @@ in type = lib.types.listOf lib.types.str; default = [ "/home" ]; }; + + inhibitsSleep = lib.mkOption { + type = lib.types.bool; + default = config.host.role != "laptop"; + }; }; config = lib.mkIf cfg.enable { @@ -53,6 +58,7 @@ in Persistent = true; }; initialize = true; + inherit (cfg) inhibitsSleep; extraBackupArgs = [ "--one-file-system" ]; pruneOpts = [ "--keep-daily 7" @@ -62,5 +68,11 @@ in ]; environmentFile = config.sops.templates."restic/b2-env-${host}".path; }; + + systemd.services.restic-backups-home = { + unitConfig = { + RequiresMountsFor = cfg.paths; + }; + }; }; }