2022-12-11 14:56:09 +00:00
|
|
|
# Generates the documentation for library functions via nixdoc.
|
2018-12-30 00:10:19 +00:00
|
|
|
|
2022-12-11 14:56:09 +00:00
|
|
|
{ pkgs, locationsXml, libsets }:
|
2018-12-30 00:10:19 +00:00
|
|
|
|
|
|
|
with pkgs; stdenv.mkDerivation {
|
|
|
|
name = "nixpkgs-lib-docs";
|
2022-12-11 14:56:09 +00:00
|
|
|
src = ../../lib;
|
2018-12-30 00:10:19 +00:00
|
|
|
|
|
|
|
buildInputs = [ nixdoc ];
|
|
|
|
installPhase = ''
|
|
|
|
function docgen {
|
2022-12-11 14:56:09 +00:00
|
|
|
nixdoc -c "$1" -d "$2" -f "$1.nix" > "$out/$1.xml"
|
|
|
|
echo "<xi:include href='$1.xml' />" >> "$out/index.xml"
|
2018-12-30 00:10:19 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 14:56:09 +00:00
|
|
|
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
|
|
|
|
|
2022-12-12 11:21:59 +00:00
|
|
|
${lib.concatMapStrings ({ name, description }: ''
|
2022-12-11 14:56:09 +00:00
|
|
|
docgen ${name} ${lib.escapeShellArg description}
|
2022-12-12 11:21:59 +00:00
|
|
|
'') libsets}
|
2018-12-30 00:10:19 +00:00
|
|
|
|
2022-12-11 14:56:09 +00:00
|
|
|
echo "</root>" >> "$out/index.xml"
|
|
|
|
|
|
|
|
ln -s ${locationsXml} $out/locations.xml
|
2018-12-30 00:10:19 +00:00
|
|
|
'';
|
|
|
|
}
|