# Generates the documentation for library functions via nixdoc.
{ pkgs, locationsXml, libsets }:
with pkgs; stdenv.mkDerivation {
name = "nixpkgs-lib-docs";
src = ../../lib;
buildInputs = [ nixdoc ];
installPhase = ''
function docgen {
nixdoc -c "$1" -d "$2" -f "$1.nix" > "$out/$1.xml"
echo "" >> "$out/index.xml"
}
mkdir -p "$out"
cat > "$out/index.xml" << 'EOF'
EOF
${lib.concatMapStrings ({ name, description }: ''
docgen ${name} ${lib.escapeShellArg description}
'') libsets}
echo "" >> "$out/index.xml"
ln -s ${locationsXml} $out/locations.xml
'';
}