From 2be6684d68fad9839ef503289568ae66a6013dee Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Fri, 1 Aug 2025 12:49:19 +0200 Subject: [PATCH] remove module functions from application resources --- deployment/data-model-test.nix | 9 +++--- deployment/data-model.nix | 51 ++++++++++++---------------------- 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/deployment/data-model-test.nix b/deployment/data-model-test.nix index 24d5cd6c..0486550c 100644 --- a/deployment/data-model-test.nix +++ b/deployment/data-model-test.nix @@ -99,12 +99,11 @@ in { options.enable = lib.mkEnableOption "Hello in the shell"; }; - implementation = cfg: { - input = cfg; - output = lib.optionalAttrs cfg.enable { + implementation = + cfg: + lib.optionalAttrs cfg.enable { resources.hello.login-shell.packages.hello = pkgs.hello; }; - }; }; environments.single-nixos-vm = { 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; environment = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell; result = mkDeployment { diff --git a/deployment/data-model.nix b/deployment/data-model.nix index c3d5d53a..24e90284 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -85,41 +85,24 @@ in }; applications = mkOption { description = "Collection of Fediversity applications"; - type = attrsOf ( - submodule (application: { - _class = "fediversity-application"; - options = { - description = mkOption { - description = "Description to be shown in the application overview"; - 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; - }; - }; + type = attrsOf (submodule { + _class = "fediversity-application"; + options = { + description = mkOption { + description = "Description to be shown in the application overview"; + 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 required by an application"; + # input: submodule application.config.module + type = functionTo application-resources; + }; + }; + }); }; environments = mkOption { description = "Run-time environments for Fediversity applications to be deployed to";