clan/checks: move into lib function; add tests

This commit is contained in:
Johannes Kirschbauer
2025-10-28 09:40:31 +01:00
parent b3323007b2
commit 0060ead876
6 changed files with 83 additions and 25 deletions

19
lib/clan/checkConfig.nix Normal file
View File

@@ -0,0 +1,19 @@
{ lib, ... }:
/**
Function to assert clan configuration checks.
Arguments:
- 'checks' attribute of clan configuration
- Any: the returned configuration (can be anything, is just passed through)
*/
checks:
lib.deepSeq (
lib.mapAttrs (
id: check:
if check.ignore || check.assertion then
null
else
throw "clan.checks.${id} failed with message\n${check.message}"
) checks
)