Inventory: set {name,meta.name} automatically
This commit is contained in:
@@ -160,10 +160,10 @@ let
|
||||
{
|
||||
config.clan.${serviceName} = lib.mkMerge (
|
||||
[
|
||||
(globalConfig)
|
||||
(lib.traceValSeq machineServiceConfig)
|
||||
globalConfig
|
||||
machineServiceConfig
|
||||
]
|
||||
++ (roleServiceConfigs)
|
||||
++ roleServiceConfigs
|
||||
);
|
||||
}
|
||||
)
|
||||
|
||||
@@ -13,6 +13,20 @@ let
|
||||
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 {
|
||||
default = { };
|
||||
@@ -64,9 +78,12 @@ in
|
||||
machines = lib.mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf (
|
||||
types.submodule {
|
||||
types.submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options = {
|
||||
inherit (metaOptions) name description icon;
|
||||
inherit (metaOptionsWith name) name description icon;
|
||||
|
||||
tags = lib.mkOption {
|
||||
|
||||
default = [ ];
|
||||
@@ -84,6 +101,7 @@ in
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -91,8 +109,10 @@ in
|
||||
default = { };
|
||||
type = types.attrsOf (
|
||||
types.attrsOf (
|
||||
types.submodule {
|
||||
options.meta = metaOptions;
|
||||
types.submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options.meta = metaOptionsWith name;
|
||||
options.imports = importsOption;
|
||||
options.config = moduleConfig;
|
||||
options.machines = lib.mkOption {
|
||||
@@ -124,6 +144,7 @@ in
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user