diff --git a/lib/types.nix b/lib/types.nix index acad53d7f5cac..d646a72082b65 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -366,8 +366,8 @@ rec { fullSubmodule = { configDefault ? false , modules ? [] + , optionsModules ? null , specialArgs ? {} - , hideSubOptions ? false }@attrs: let inherit (lib.modules) evalModules; @@ -391,8 +391,11 @@ rec { args.name = last loc; prefix = loc; }).config; - getSubOptions = prefix: optionalAttrs (!hideSubOptions) (evalModules - { inherit modules prefix specialArgs; + getSubOptions = prefix: (evalModules + { inherit prefix specialArgs; + modules = if optionsModules == null + then modules + else optionsModules; # This is a work-around due to the fact that some sub-modules, # such as the one included in an attribute set, expects a "args" # attribute to be given to the sub-module. As the option diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index bbeebdb9db801..518dbe424595a 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -634,6 +634,7 @@ in in mkOption { type = types.attrsOf (types.fullSubmodule { modules = [ containerDefaults containerParamsModule ] ++ baseModules; + optionsModules = [ containerParamsModule ]; specialArgs.modulesPath = builtins.toString ../.; }); default = {};