mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
8906aa28e4
Building the nixpkgs manual currently triggers a bunch of deprecation warnings, because every attribute in `lib` is evaluated to see if it's an attrset to generate locations for. Instead, share the lib subsets to include in the documentation between `lib-function-docs` and `lib-function-locations` so they can coordinate. Also generate the list of sections instead of duplicating it in `library.xml`.
31 lines
774 B
Nix
31 lines
774 B
Nix
# 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 "<xi:include href='$1.xml' />" >> "$out/index.xml"
|
|
}
|
|
|
|
mkdir -p "$out"
|
|
|
|
cat > "$out/index.xml" << 'EOF'
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<root xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
EOF
|
|
|
|
${lib.concatStrings (lib.mapAttrsToList (name: description: ''
|
|
docgen ${name} ${lib.escapeShellArg description}
|
|
'') libsets)}
|
|
|
|
echo "</root>" >> "$out/index.xml"
|
|
|
|
ln -s ${locationsXml} $out/locations.xml
|
|
'';
|
|
}
|