From c764c0f7b6cec1efa0946834416f410765fe1095 Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Mon, 30 Jun 2025 14:04:54 +0200 Subject: [PATCH] better reflect naming from diagram configuration data flow --- deployment/data-model-test.nix | 42 +++++++++++++++------------------- deployment/data-model.nix | 32 ++++++++++++++++---------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/deployment/data-model-test.nix b/deployment/data-model-test.nix index 053f7ba2..16a5caaf 100644 --- a/deployment/data-model-test.nix +++ b/deployment/data-model-test.nix @@ -19,50 +19,46 @@ in example = eval ( { config, ... }: { - runtime-configurations.single-ssh-host = + providers.single-ssh-host = { ... }: { system.stateVersion = "25.05"; }; - runtime-environments.bar = { - single-ssh-host = { - ssh = { - host = "localhost"; - username = "root"; - authentication.password = ""; - }; + resources.bar.runtime-environment.single-ssh-host = { + ssh = { + host = "localhost"; + username = "root"; + authentication.password = ""; }; }; - applications.foo = { - module = - { pkgs, ... }: - { - environment.systemPackages = [ - pkgs.hello - ]; - }; - }; + applications.foo.module = + { pkgs, ... }: + { + environment.systemPackages = [ + pkgs.hello + ]; + }; deployments.baz = { module = { }; - runtime-environment = config.runtime-environments.bar; + runtime-environment = config.resources.bar.runtime-environment; }; migrations.boo = { deployment = config.deployments.baz; - runtime-environment = config.runtime-environments.bar; + runtime-environment = config.resources.bar.runtime-environment; }; } ); in { - has-runtime-configuration = lib.isAttrs example.runtime-configurations.single-ssh-host; - has-runtime-environment = lib.isAttrs example.runtime-environments.bar.single-ssh-host.module; + has-provider = lib.isAttrs example.providers.single-ssh-host; + has-resource = lib.isAttrs example.resources.bar.runtime-environment.single-ssh-host.module; has-application = lib.isAttrs example.applications.foo.module; has-deployment = lib.isAttrs example.deployments.baz.module; has-migration = lib.isAttrs example.migrations.boo.deployment; }; expected = { - has-runtime-configuration = true; - has-runtime-environment = true; + has-provider = true; + has-resource = true; has-application = true; has-deployment = true; has-migration = true; diff --git a/deployment/data-model.nix b/deployment/data-model.nix index 78bfefca..2a52728c 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -20,8 +20,8 @@ let submodule str ; - runtime-configuration = mkOption { - description = "The NixOS module of a run-time environment"; + provider = mkOption { + description = "The NixOS module of a provider"; type = deferredModule; default = { _class = "nixos"; @@ -37,9 +37,9 @@ let // { type = mergeTypes type (submodule { options.module = mkOption { - description = "The NixOS module of the run-time environment"; + description = "The NixOS module of the provider"; type = deferredModule; - default = config.runtime-configurations.${name}; + default = config.providers.${name}; readOnly = true; }; }); @@ -94,13 +94,21 @@ let }; } ); + resource = attrTag { + runtime-environment = mkOption { + description = "A run-time environment one may deploy a NixOS configuration to."; + type = runtime-environment; + }; + }; application = submoduleWith { description = "A Fediversity application"; modules = [ { options = { module = mkOption { - description = "The NixOS module for that application, for configuring that application"; + description = '' + The NixOS module to configure the application. + ''; type = deferredModule; }; }; @@ -147,16 +155,16 @@ let in { options = { - runtime-configurations = mkOption { - description = "Collection of runtime environments into which applications can be deployed"; - type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: runtime-configuration)); + providers = mkOption { + description = "Collection of providers for run-time environments to deploy applications to"; + type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: provider)); }; - runtime-environments = mkOption { - description = "Collection of runtime environments into which applications can be deployed"; - type = attrsOf runtime-environment; + resources = mkOption { + description = "Collection of resources for use in Fediversity applications"; + type = attrsOf resource; }; applications = mkOption { - description = "Collection of Fediversity applications"; + description = "Collection of (available) Fediversity applications"; type = attrsOf application; }; deployments = mkOption {