diff --git a/lib/default.nix b/lib/default.nix index 070c2a67cf07..e2a93e63ac1f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -131,7 +131,8 @@ let getValues getFiles optionAttrSetToDocList optionAttrSetToDocList' scrubOptionValue literalExpression literalExample literalDocBook - showOption showFiles unknownModule mkOption mkPackageOption + showOption showOptionWithDefLocs showFiles + unknownModule mkOption mkPackageOption mdDoc literalMD; inherit (self.types) isType setType defaultTypeMerge defaultFunctor isOptionType mkOptionType; diff --git a/lib/options.nix b/lib/options.nix index 50b19e483736..afae1769afdd 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -7,6 +7,7 @@ let collect concatLists concatMap + concatMapStringsSep elemAt filter foldl' @@ -340,6 +341,11 @@ rec { in "\n- In `${def.file}'${result}" ) defs; + showOptionWithDefLocs = opt: '' + ${showOption opt.loc}, with values defined in: + ${concatMapStringsSep "\n" (defFile: " - ${defFile}") opt.files} + ''; + unknownModule = ""; }