diff options
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 4966619f663..a6f8b77deb2 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -537,7 +537,7 @@ let mergeModules' prefix modules (concatMap (m: map (config: { file = m._file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = prefix: options: configs: + mergeModules' = prefix: modules: configs: let # an attrset 'name' => list of submodules that declare ‘name’. declsByName = @@ -554,11 +554,11 @@ let else mapAttrs (n: option: - [{ inherit (module) _file; options = option; }] + [{ inherit (module) _file; pos = builtins.unsafeGetAttrPos n subtree; options = option; }] ) subtree ) - options); + modules); # The root of any module definition must be an attrset. checkedConfigs = @@ -730,9 +730,16 @@ let else res.options; in opt.options // res // { declarations = res.declarations ++ [opt._file]; + # In the case of modules that are generated dynamically, we won't + # have exact declaration lines; fall back to just the file being + # evaluated. + declarationPositions = res.declarationPositions + ++ (if opt.pos != null + then [opt.pos] + else [{ file = opt._file; line = null; column = null; }]); options = submodules; } // typeSet - ) { inherit loc; declarations = []; options = []; } opts; + ) { inherit loc; declarations = []; declarationPositions = []; options = []; } opts; /* Merge all the definitions of an option to produce the final config value. */ |