forked from Fediversity/Fediversity
remove module functions from application resources
This commit is contained in:
parent
9c219341b1
commit
2be6684d68
2 changed files with 21 additions and 39 deletions
|
@ -99,12 +99,11 @@ in
|
||||||
{
|
{
|
||||||
options.enable = lib.mkEnableOption "Hello in the shell";
|
options.enable = lib.mkEnableOption "Hello in the shell";
|
||||||
};
|
};
|
||||||
implementation = cfg: {
|
implementation =
|
||||||
input = cfg;
|
cfg:
|
||||||
output = lib.optionalAttrs cfg.enable {
|
lib.optionalAttrs cfg.enable {
|
||||||
resources.hello.login-shell.packages.hello = pkgs.hello;
|
resources.hello.login-shell.packages.hello = pkgs.hello;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
environments.single-nixos-vm =
|
environments.single-nixos-vm =
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
|
@ -152,7 +151,7 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
resources = fediversity.applications.hello.resources fediversity.example-configuration.applications.hello;
|
resources = fediversity.applications.hello.implementation fediversity.example-configuration.applications.hello;
|
||||||
hello-shell = resources.resources.hello.login-shell;
|
hello-shell = resources.resources.hello.login-shell;
|
||||||
environment = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell;
|
environment = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell;
|
||||||
result = mkDeployment {
|
result = mkDeployment {
|
||||||
|
|
|
@ -85,41 +85,24 @@ in
|
||||||
};
|
};
|
||||||
applications = mkOption {
|
applications = mkOption {
|
||||||
description = "Collection of Fediversity applications";
|
description = "Collection of Fediversity applications";
|
||||||
type = attrsOf (
|
type = attrsOf (submodule {
|
||||||
submodule (application: {
|
_class = "fediversity-application";
|
||||||
_class = "fediversity-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";
|
type = types.str;
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
module = mkOption {
|
|
||||||
description = "Operator-facing configuration options for the application";
|
|
||||||
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 {
|
|
||||||
description = "Compute resources required by an application";
|
|
||||||
type = functionTo application.config.config-mapping.output-type;
|
|
||||||
readOnly = true;
|
|
||||||
default = input: (application.config.implementation input).output;
|
|
||||||
};
|
|
||||||
# TODO(@fricklerhandwerk): this needs a better name, it's just the type
|
|
||||||
config-mapping = mkOption {
|
|
||||||
description = "Function type for the mapping from application configuration to required resources";
|
|
||||||
type = submodule functionType;
|
|
||||||
readOnly = true;
|
|
||||||
default = {
|
|
||||||
input-type = submodule application.config.module;
|
|
||||||
output-type = application-resources;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
})
|
module = mkOption {
|
||||||
);
|
description = "Operator-facing configuration options for the application";
|
||||||
|
type = deferredModuleWith { staticModules = [ { _class = "fediversity-application-config"; } ]; };
|
||||||
|
};
|
||||||
|
implementation = mkOption {
|
||||||
|
description = "Mapping of application configuration to deployment resources required by an application";
|
||||||
|
# input: submodule application.config.module
|
||||||
|
type = functionTo application-resources;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
environments = mkOption {
|
environments = mkOption {
|
||||||
description = "Run-time environments for Fediversity applications to be deployed to";
|
description = "Run-time environments for Fediversity applications to be deployed to";
|
||||||
|
|
Loading…
Add table
Reference in a new issue