Inventory: set {name,meta.name} automatically
This commit is contained in:
@@ -160,10 +160,10 @@ let
|
|||||||
{
|
{
|
||||||
config.clan.${serviceName} = lib.mkMerge (
|
config.clan.${serviceName} = lib.mkMerge (
|
||||||
[
|
[
|
||||||
(globalConfig)
|
globalConfig
|
||||||
(lib.traceValSeq machineServiceConfig)
|
machineServiceConfig
|
||||||
]
|
]
|
||||||
++ (roleServiceConfigs)
|
++ roleServiceConfigs
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,6 +13,20 @@ let
|
|||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
metaOptionsWith = name: {
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
description = lib.mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
};
|
||||||
|
icon = lib.mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
moduleConfig = lib.mkOption {
|
moduleConfig = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
@@ -64,26 +78,30 @@ in
|
|||||||
machines = lib.mkOption {
|
machines = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
type = types.attrsOf (
|
type = types.attrsOf (
|
||||||
types.submodule {
|
types.submodule (
|
||||||
options = {
|
{ name, ... }:
|
||||||
inherit (metaOptions) name description icon;
|
{
|
||||||
tags = lib.mkOption {
|
options = {
|
||||||
|
inherit (metaOptionsWith name) name description icon;
|
||||||
|
|
||||||
default = [ ];
|
tags = lib.mkOption {
|
||||||
apply = lib.unique;
|
|
||||||
type = types.listOf types.str;
|
default = [ ];
|
||||||
|
apply = lib.unique;
|
||||||
|
type = types.listOf types.str;
|
||||||
|
};
|
||||||
|
system = 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;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
system = 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,38 +109,41 @@ in
|
|||||||
default = { };
|
default = { };
|
||||||
type = types.attrsOf (
|
type = types.attrsOf (
|
||||||
types.attrsOf (
|
types.attrsOf (
|
||||||
types.submodule {
|
types.submodule (
|
||||||
options.meta = metaOptions;
|
{ name, ... }:
|
||||||
options.imports = importsOption;
|
{
|
||||||
options.config = moduleConfig;
|
options.meta = metaOptionsWith name;
|
||||||
options.machines = lib.mkOption {
|
options.imports = importsOption;
|
||||||
default = { };
|
options.config = moduleConfig;
|
||||||
type = types.attrsOf (
|
options.machines = lib.mkOption {
|
||||||
types.submodule {
|
default = { };
|
||||||
options.imports = importsOption;
|
type = types.attrsOf (
|
||||||
options.config = moduleConfig;
|
types.submodule {
|
||||||
}
|
options.imports = importsOption;
|
||||||
);
|
options.config = moduleConfig;
|
||||||
};
|
}
|
||||||
options.roles = lib.mkOption {
|
);
|
||||||
default = { };
|
};
|
||||||
type = types.attrsOf (
|
options.roles = lib.mkOption {
|
||||||
types.submodule {
|
default = { };
|
||||||
options.machines = lib.mkOption {
|
type = types.attrsOf (
|
||||||
default = [ ];
|
types.submodule {
|
||||||
type = types.listOf types.str;
|
options.machines = lib.mkOption {
|
||||||
};
|
default = [ ];
|
||||||
options.tags = lib.mkOption {
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
};
|
||||||
apply = lib.unique;
|
options.tags = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
default = [ ];
|
||||||
};
|
apply = lib.unique;
|
||||||
options.config = moduleConfig;
|
type = types.listOf types.str;
|
||||||
options.imports = importsOption;
|
};
|
||||||
}
|
options.config = moduleConfig;
|
||||||
);
|
options.imports = importsOption;
|
||||||
};
|
}
|
||||||
}
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user