Skip to content

Commit cd74159

Browse files
committed
replace hideSubOptions with more granular approach.
Since we are introspecting only options, we don't need all modules, but only modules with extra options. When `null` we'll use all the modules. This should cover `containers` usecase, and most others.
1 parent 729bfbf commit cd74159

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/types.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ rec {
366366
fullSubmodule =
367367
{ configDefault ? false
368368
, modules ? []
369+
, optionsModules ? null
369370
, specialArgs ? {}
370-
, hideSubOptions ? false
371371
}@attrs:
372372
let
373373
inherit (lib.modules) evalModules;
@@ -391,8 +391,11 @@ rec {
391391
args.name = last loc;
392392
prefix = loc;
393393
}).config;
394-
getSubOptions = prefix: optionalAttrs (!hideSubOptions) (evalModules
395-
{ inherit modules prefix specialArgs;
394+
getSubOptions = prefix: (evalModules
395+
{ inherit prefix specialArgs;
396+
modules = if optionsModules == null
397+
then modules
398+
else optionsModules;
396399
# This is a work-around due to the fact that some sub-modules,
397400
# such as the one included in an attribute set, expects a "args"
398401
# attribute to be given to the sub-module. As the option

nixos/modules/virtualisation/containers.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ in
634634
in mkOption {
635635
type = types.attrsOf (types.fullSubmodule {
636636
modules = [ containerDefaults containerParamsModule ] ++ baseModules;
637+
optionsModules = [ containerParamsModule ];
637638
specialArgs.modulesPath = builtins.toString ../.;
638639
});
639640
default = {};

0 commit comments

Comments
 (0)