showOptionWithDefLocs
lib.options.showOptionWithDefLocs
Docs pulled from | This Revision | 43 minutes ago
Pretty prints all option definition locations
Inputs
option
- The option to pretty print
Examples
lib.options.showOptionWithDefLocs
usage example
showOptionWithDefLocs { loc = ["x" "y" ]; files = [ "foo.nix" "bar.nix" ]; }
"x.y, with values defined in:\n - foo.nix\n - bar.nix\n"
nix-repl> eval = lib.evalModules {
modules = [
{
options = {
foo = lib.mkEnableOption "foo";
};
}
];
}
nix-repl> lib.options.showOptionWithDefLocs eval.options.foo
"foo, with values defined in:\n - <unknown-file>\n"
Type
showDefsSep :: { files :: [ String ]; loc :: [ String ]; ... } -> string
Noogle detected
Implementation
The following is the current implementation of this function.
showOptionWithDefLocs = opt: ''
${showOption opt.loc}, with values defined in:
${concatMapStringsSep "\n" (defFile: " - ${defFile}") opt.files}
'';