diff --git a/deployment/data-model.nix b/deployment/data-model.nix index cd0d7b77..ea804588 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -1,6 +1,7 @@ { lib, config, + options, ... }: let @@ -149,24 +150,27 @@ in Setting this is optional, but provides a place to declare that information for programmatic use in the resource mapping. ''; # TODO: maybe transpose, and group the resources by type instead - # # FIXME: error: The option `environments.single-nixos-vm.resources.shell.login-shell.apply' does not exist. Definition values: - # # - In `': - # # However there are no options defined in `environments.single-nixos-vm.resources.shell.login-shell'. Are you sure you've - # # declared your options properly? This can happen if you e.g. declared your options in `types.submodule' - # # under `config' rather than `options'. - # type = attrsOf ( - # attrTag ( - # lib.mapAttrs ( - # _name: resource: - # mkOption { - # type = submoduleWith { - # class = "fediversity-resource-policy"; - # modules = [ resource.policy ]; - # }; - # } - # ) config.resources - # ) - # ); + type = attrsOf ( + attrTag ( + lib.mapAttrs ( + name: resource: + mkOption { + type = submoduleWith { + class = "fediversity-resource-policy"; + modules = + (lib.evalModules { + modules = + options.resources.type.nestedTypes.elemType.getSubModules + ; + }).options.policy.type.getSubModules + ++ [ + options.resources.value.${name} + ]; + }; + } + ) config.resources + ) + ); }; implementation = mkOption { description = "Mapping of resources required by applications to available resources; the result can be deployed";