backup: assert that backups are on if a path is configured, don't create empty units

This commit is contained in:
Sandro - 2023-11-11 04:28:31 +01:00
parent 865a741401
commit 345b3a5a9d
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 6 additions and 1 deletions

View File

@ -23,6 +23,11 @@ in
};
config = {
assertions = [ {
assertion = cfg.paths != [ ] -> !cfg.enable;
message = "Configuring backup services.backup.paths without enabling services.backup.enable is useless!";
} ];
services = {
postgresqlBackup = {
inherit (config.services.postgresql) enable;
@ -102,7 +107,7 @@ in
ln -fs {,/home}/root/.ssh/config
'';
systemd = {
systemd = lib.mkIf cfg.enable {
services = {
restic-backups-server8.serviceConfig.Environment = "RESTIC_PROGRESS_FPS=0.016666";
restic-backups-offsite.serviceConfig.Environment = "RESTIC_PROGRESS_FPS=0.016666";