diff options
author | Naïm Favier <n@monade.li> | 2022-12-11 15:56:09 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-12-22 11:31:08 +0100 |
commit | 8906aa28e4de1f1b53a99691c1373292f1106766 (patch) | |
tree | 075ff85215c4658a0e8e93b9cac12051ae1962bf /doc/doc-support/lib-function-docs.nix | |
parent | cd39b90b6f5c7333116c75b1cb9a132cf2d56714 (diff) |
doc/lib-functions: remove warnings
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`.
Diffstat (limited to 'doc/doc-support/lib-function-docs.nix')
-rw-r--r-- | doc/doc-support/lib-function-docs.nix | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/doc/doc-support/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix index 4e67609e23fb2..a11de1a9f6f1b 100644 --- a/doc/doc-support/lib-function-docs.nix +++ b/doc/doc-support/lib-function-docs.nix @@ -1,30 +1,31 @@ -# Generates the documentation for library functions via nixdoc. To add -# another library function file to this list, the include list in the -# file `doc/functions/library.xml` must also be updated. +# Generates the documentation for library functions via nixdoc. -{ pkgs ? import ./.. {}, locationsXml }: +{ pkgs, locationsXml, libsets }: with pkgs; stdenv.mkDerivation { name = "nixpkgs-lib-docs"; - src = ./../../lib; + src = ../../lib; buildInputs = [ nixdoc ]; installPhase = '' function docgen { - nixdoc -c "$1" -d "$2" -f "../lib/$1.nix" > "$out/$1.xml" + nixdoc -c "$1" -d "$2" -f "$1.nix" > "$out/$1.xml" + echo "<xi:include href='$1.xml' />" >> "$out/index.xml" } - mkdir -p $out - ln -s ${locationsXml} $out/locations.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)} - docgen asserts 'Assert functions' - docgen attrsets 'Attribute-set functions' - docgen strings 'String manipulation functions' - docgen trivial 'Miscellaneous functions' - docgen lists 'List manipulation functions' - docgen debug 'Debugging functions' - docgen options 'NixOS / nixpkgs option handling' - docgen filesystem 'Filesystem functions' - docgen sources 'Source filtering functions' + echo "</root>" >> "$out/index.xml" + + ln -s ${locationsXml} $out/locations.xml ''; } |