diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix index 10667dc3ade..d9b9d3b54c1 100644 --- a/pkgs/lib/modules.nix +++ b/pkgs/lib/modules.nix @@ -207,6 +207,19 @@ rec { addOptionMakeUp { name = addName name; recurseInto = recurseForOption; } (mergeOptionDecls decls) + // { + declarations = + map (m: { + source = m.key; + value = m.options; + }) (declarationsOf name); + + definitions = + map (m: { + source = m.key; + value = m.config; + }) (definitionsOf name); + } else if all isAttrs values then (recurseInto name modules).options else diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index 6aad285b7ac..06d4fad8a32 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -240,6 +240,9 @@ rec { inherit (opt) name; description = if opt ? description then opt.description else throw "Option ${opt.name}: No description."; + + declarations = map (x: toString x.source) opt.declarations; + definitions = map (x: toString x.source) opt.definitions; } // (if opt ? example then {inherit(opt) example;} else {}) // (if opt ? default then {inherit(opt) default;} else {});