Merge pull request 'clan/inventory: allow list usage of roles via polymorphism' (#4918) from cleanup-again into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4918
This commit is contained in:
hsjobeki
2025-08-25 10:41:49 +00:00
6 changed files with 12 additions and 17 deletions

View File

@@ -21,14 +21,14 @@ let
"secrets"
"templates"
];
clanSchema = jsonLib.parseOptions (lib.filterAttrs (n: _v: lib.elem n include) clanOpts) { };
clanSchemaNix = jsonLib.parseOptions (lib.filterAttrs (n: _v: lib.elem n include) clanOpts) { };
clan-schema-abstract = pkgs.stdenv.mkDerivation {
clanSchemaJson = pkgs.stdenv.mkDerivation {
name = "clan-schema-files";
buildInputs = [ pkgs.cue ];
src = ./.;
buildPhase = ''
export SCHEMA=${builtins.toFile "clan-schema.json" (builtins.toJSON clanSchema)}
export SCHEMA=${builtins.toFile "clan-schema.json" (builtins.toJSON clanSchemaNix)}
cp $SCHEMA schema.json
# Also generate a CUE schema version that is derived from the JSON schema
cue import -f -p compose -l '#Root:' schema.json
@@ -41,7 +41,7 @@ in
{
inherit
flakeOptions
clanSchema
clan-schema-abstract
clanSchemaNix
clanSchemaJson
;
}

View File

@@ -27,7 +27,9 @@ in
default = { };
};
tags = lib.mkOption {
type = types.attrsOf (types.submodule { });
type = types.coercedTo (types.listOf types.str) (t: lib.genAttrs t (_: { })) (
types.attrsOf (types.submodule { })
);
default = { };
};
settings =