mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 21:21:06 +00:00
Add declarations and definitions to options. This allow you to retrieve
the location of the definition with the defined value. Filter the source location for the documentation. svn path=/nixpkgs/trunk/; revision=17253
This commit is contained in:
parent
e07f5d2a2c
commit
c6267a8c9d
|
@ -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
|
||||
|
|
|
@ -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 {});
|
||||
|
|
Loading…
Reference in a new issue