From 16553f2c836371d3fab643be15549bceab93da85 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 30 Jan 2025 15:27:56 +0100 Subject: [PATCH] services.mysqlBackup: add assertion that all databases in singleTransaction must be included in the databases option --- nixos/modules/services/backup/mysql-backup.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nixos/modules/services/backup/mysql-backup.nix b/nixos/modules/services/backup/mysql-backup.nix index ffa9af5ded79..7e6a0b76d08f 100644 --- a/nixos/modules/services/backup/mysql-backup.nix +++ b/nixos/modules/services/backup/mysql-backup.nix @@ -175,6 +175,12 @@ in || selectedAlg.minLevel <= cfg.compressionLevel && cfg.compressionLevel <= selectedAlg.maxLevel; message = "${cfg.compressionAlg} compression level must be between ${toString selectedAlg.minLevel} and ${toString selectedAlg.maxLevel}"; } + { + assertion = + !(lib.isList cfg.singleTransaction) + || lib.all (db: lib.elem db cfg.databases) cfg.singleTransaction; + message = "All databases in singleTransaction must be included in the databases option"; + } ]; # ensure unix user to be used to perform backup exist.