{ pkgs ? (import ./.. { }), nixpkgs ? { }}: let revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.revision or "master"); libDefPos = set: builtins.map (name: { name = name; location = builtins.unsafeGetAttrPos name set; }) (builtins.attrNames set); libset = toplib: builtins.map (subsetname: { subsetname = subsetname; functions = libDefPos toplib."${subsetname}"; }) (builtins.filter (name: builtins.isAttrs toplib."${name}") (builtins.attrNames toplib)); nixpkgsLib = pkgs.lib; flattenedLibSubset = { subsetname, functions }: builtins.map (fn: { name = "lib.${subsetname}.${fn.name}"; value = fn.location; }) functions; locatedlibsets = libs: builtins.map flattenedLibSubset (libset libs); removeFilenamePrefix = prefix: filename: let prefixLen = (builtins.stringLength prefix) + 1; # +1 to remove the leading / filenameLen = builtins.stringLength filename; substr = builtins.substring prefixLen filenameLen filename; in substr; removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path); liblocations = builtins.filter (elem: elem.value != null) (nixpkgsLib.lists.flatten (locatedlibsets nixpkgsLib)); fnLocationRelative = { name, value }: { inherit name; value = value // { file = removeNixpkgs value.file; }; }; relativeLocs = (builtins.map fnLocationRelative liblocations); sanitizeId = builtins.replaceStrings [ "'" ] [ "-prime" ]; urlPrefix = "https://github.com/NixOS/nixpkgs/blob/${revision}"; xmlstrings = (nixpkgsLib.strings.concatMapStrings ({ name, value }: ''
${name} Located at ${value.file}:${builtins.toString value.line} in <nixpkgs>.
'') relativeLocs); in pkgs.writeText "locations.xml" ''
All the locations for every lib function This file is only for inclusion by other files. ${xmlstrings}
''