From fefcd93bc177b2b7f324645bbc37f37ee4d8a306 Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Mon, 23 Jun 2025 11:25:18 +0200 Subject: [PATCH] grant run-time environments their own modules with their own description --- deployment/data-model.nix | 47 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/deployment/data-model.nix b/deployment/data-model.nix index 773c0f91..b6e11a17 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -4,12 +4,19 @@ ... }: let - inherit (lib) attrNames mkOption genAttrs; + inherit (lib) + attrNames + mapAttrs + mkOption + genAttrs + ; inherit (lib.types) attrsOf attrTag deferredModule + mergeTypes submoduleWith + submodule ; runtime-configuration = mkOption { description = "The NixOS module of a run-time environment"; @@ -21,26 +28,28 @@ let runtime-environment = attrTag ( mapAttrs ( - name: options: - mkOption { - type = submoduleWith { - modules = [ - { - options = options // { - module = mkOption { - description = "The NixOS module of the run-time environment"; - type = deferredModule; - default = config.runtime-configurations.${name}; - readOnly = true; - }; - }; - } - ]; - }; - } + name: + option@{ type, ... }: + mkOption ( + option + // { + type = mergeTypes type (submodule { + options.module = mkOption { + description = "The NixOS module of the run-time environment"; + type = deferredModule; + default = config.runtime-configurations.${name}; + readOnly = true; + }; + }); + } + ) ) { - nixos = { }; + nixos = { + description = "A NixOS instance to deploy to."; + type = submodule { + }; + }; } ); application = submoduleWith {