forked from Fediversity/Fediversity
untangle applications from function type, as they seem to not need the introspection (and may type-check input without it)
This commit is contained in:
parent
d429c32df0
commit
10a2d29e54
2 changed files with 5 additions and 23 deletions
|
@ -118,7 +118,7 @@ in
|
||||||
enable = lib.mkEnableOption "Hello in the shell";
|
enable = lib.mkEnableOption "Hello in the shell";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
implementation =
|
resources =
|
||||||
cfg:
|
cfg:
|
||||||
lib.optionalAttrs cfg.enable {
|
lib.optionalAttrs cfg.enable {
|
||||||
_class = "fediversity-application-requirements";
|
_class = "fediversity-application-requirements";
|
||||||
|
|
|
@ -72,7 +72,7 @@ in
|
||||||
type = attrsOf (submoduleWith {
|
type = attrsOf (submoduleWith {
|
||||||
class = "fediversity-application";
|
class = "fediversity-application";
|
||||||
modules = [
|
modules = [
|
||||||
(application: {
|
{
|
||||||
options = {
|
options = {
|
||||||
description = mkOption {
|
description = mkOption {
|
||||||
description = "Description to be shown in the application overview";
|
description = "Description to be shown in the application overview";
|
||||||
|
@ -82,30 +82,12 @@ in
|
||||||
description = "Operator-facing configuration options for the application";
|
description = "Operator-facing configuration options for the application";
|
||||||
type = deferredModuleWith { staticModules = [ { _class = "fediversity-application-config"; } ]; };
|
type = deferredModuleWith { staticModules = [ { _class = "fediversity-application-config"; } ]; };
|
||||||
};
|
};
|
||||||
implementation = mkOption {
|
|
||||||
description = "Mapping of application configuration to deployment resources, a description of what an application needs to run";
|
|
||||||
type = application.config.config-mapping.function-type;
|
|
||||||
};
|
|
||||||
resources = mkOption {
|
resources = mkOption {
|
||||||
description = "Compute resources required by an application";
|
description = "Mapping of application configuration to deployment resources, a description of what an application needs to run";
|
||||||
type = functionTo application.config.config-mapping.output-type;
|
type = functionTo (types.submodule application-requirements);
|
||||||
readOnly = true;
|
|
||||||
default = input: (application.config.implementation input).output;
|
|
||||||
};
|
|
||||||
config-mapping = mkOption {
|
|
||||||
description = "Function type for the mapping from application configuration to required resources";
|
|
||||||
type = submoduleWith {
|
|
||||||
class = "module-function";
|
|
||||||
modules = [ functionType ];
|
|
||||||
};
|
|
||||||
readOnly = true;
|
|
||||||
default = {
|
|
||||||
input-type = application.config.module;
|
|
||||||
output-type = application-requirements;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue