fix data model issues introduced at #501 (#509)

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
Reviewed-on: Fediversity/Fediversity#509
This commit is contained in:
Kiara Grouwstra 2025-09-03 14:07:53 +02:00
parent 09db4d6217
commit 27f96b2504

View file

@ -156,7 +156,16 @@ in
type = functionType; type = functionType;
readOnly = true; readOnly = true;
default = { default = {
input-type = application-resources; input-type = submodule {
options = {
deployment-name = mkOption {
type = types.str;
};
required-resources = mkOption {
type = attrsOf application-resources;
};
};
};
output-type = deployment; output-type = deployment;
implementation = environment.config.implementation; implementation = environment.config.implementation;
}; };
@ -166,17 +175,29 @@ in
type = submodule functionType; type = submodule functionType;
readOnly = true; readOnly = true;
default = { default = {
input-type = config.configuration; input-type = submodule {
output-type = nixops4Deployment; options = {
deployment-name = mkOption {
type = types.str;
};
configuration = mkOption {
type = config.configuration;
};
};
};
output-type = deployment;
implementation = implementation =
cfg: {
deployment-name,
configuration,
}:
# TODO: check cfg.enable.true # TODO: check cfg.enable.true
let let
required-resources = lib.mapAttrs ( required-resources = lib.mapAttrs (
name: application-settings: config.applications.${name}.resources application-settings name: application-settings: config.applications.${name}.resources application-settings
) cfg.applications; ) configuration.applications;
in in
environment.config.resource-mapping.apply required-resources; environment.config.resource-mapping.apply { inherit required-resources deployment-name; };
}; };
}; };
# TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`, # TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`,