Init: Autogenerate classes from nix interfaces
This commit is contained in:
@@ -41,6 +41,7 @@ in
|
||||
options = {
|
||||
inherit (metaOptions) name description icon;
|
||||
tags = lib.mkOption {
|
||||
|
||||
default = [ ];
|
||||
apply = lib.unique;
|
||||
type = types.listOf types.str;
|
||||
@@ -49,16 +50,10 @@ in
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
deploy = lib.mkOption {
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
targetHost = lib.mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
deploy.targetHost = lib.mkOption {
|
||||
description = "Configuration for the deployment of the machine";
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ let
|
||||
inventorySchema.properties.services.additionalProperties.additionalProperties.properties.meta;
|
||||
config = {
|
||||
title = "${moduleName}-config";
|
||||
default = { };
|
||||
} // moduleSchema;
|
||||
roles = {
|
||||
type = "object";
|
||||
@@ -69,6 +70,7 @@ let
|
||||
{
|
||||
properties.config = {
|
||||
title = "${moduleName}-config";
|
||||
default = { };
|
||||
} // moduleSchema;
|
||||
};
|
||||
}) (rolesOf moduleName)
|
||||
@@ -80,6 +82,7 @@ let
|
||||
{
|
||||
additionalProperties.properties.config = {
|
||||
title = "${moduleName}-config";
|
||||
default = { };
|
||||
} // moduleSchema;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -318,7 +318,7 @@ rec {
|
||||
# return jsonschema property definition for submodule
|
||||
# then (lib.attrNames (option.type.getSubOptions option.loc).opt)
|
||||
then
|
||||
parseOptions' (option.type.getSubOptions option.loc)
|
||||
example // description // parseOptions' (option.type.getSubOptions option.loc)
|
||||
# throw error if option type is not supported
|
||||
else
|
||||
notSupported option;
|
||||
|
||||
Reference in New Issue
Block a user