From dd0aff13d7d0d5b02e3b13c8ea961eb89370aa64 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Tue, 1 Jul 2025 12:16:29 +0200 Subject: [PATCH] WIP: implement data model as in diagram this doesn't update the tests yet because we don't have all the data types in place anyway yet, and I still need to come up with testable examples. --- deployment/data-model.nix | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/deployment/data-model.nix b/deployment/data-model.nix index ab9f4daf..aa425b1a 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -85,13 +85,29 @@ in }; }; }; - deployments = mkOption { - description = "Deployment of a configuration of applications to a run-time environment"; - type = attrsOf deployment; - }; - migrations = mkOption { - description = "Migrations from Fediversity deployments to Fediversity run-time environments"; - type = attrsOf migration; + environments = mkOption { + description = "Run-time environments for Fediversity applications to be deployed to"; + type = attrsOf ( + submodule (environment: { + _class = "fediversity-environment"; + options = { + resources = mkOption { + description = "Resources made available by the hosting provider"; + type = attrsOf ( + attrTag ( + lib.mapAttrs' (name: resource: { + ${name} = mkOption { type = resource.provider; }; + }) config.resources + ) + ); + }; + resource-mapping = mkOption { + description = "Mapping of resources required by applications to available resources; the result can be deployed"; + # TODO: type = consumer-resources /* same as the output of application.config-mapping, should be in a `let` */ -> nixops4Deployment + }; + }; + }) + ); }; }; }