Ext/modules: expose module schemas

This commit is contained in:
Johannes Kirschbauer
2024-11-21 16:41:25 +01:00
parent 0fcaf7372b
commit 3ebda7c304
5 changed files with 31 additions and 14 deletions

View File

@@ -1,8 +1,20 @@
{ lib }:
{ lib, self }:
let
# Trim the .nix extension from a filename
trimExtension = name: builtins.substring 0 (builtins.stringLength name - 4) name;
jsonWithoutHeader = self.lib.jsonschema {
includeDefaults = true;
header = { };
};
getModulesSchema =
modules:
lib.mapAttrs (
_moduleName: rolesOptions:
lib.mapAttrs (_roleName: options: jsonWithoutHeader.parseOptions options { }) rolesOptions
) (self.lib.evalClanModulesWithRoles modules);
evalFrontmatter =
{
moduleName,
@@ -90,7 +102,7 @@ in
{
inherit
frontmatterOptions
getModulesSchema
getFrontmatter
checkConstraints