1 # Generates the documentation for library functions via nixdoc.
3 { pkgs, nixpkgs, libsets }:
8 locationsJSON = import ./lib-function-locations.nix { inherit pkgs nixpkgs libsets; };
11 name = "nixpkgs-lib-docs";
14 buildInputs = [ nixdoc ];
20 # TODO: wrap lib.$name in <literal>, make nixdoc not escape it
21 if [[ -e "../lib/$baseName.nix" ]]; then
22 nixdoc -c "$name" -d "lib.$name: $description" -l ${locationsJSON} -f "$baseName.nix" > "$out/$name.md"
24 nixdoc -c "$name" -d "lib.$name: $description" -l ${locationsJSON} -f "$baseName/default.nix" > "$out/$name.md"
26 echo "$out/$name.md" >> "$out/index.md"
31 cat > "$out/index.md" << 'EOF'
32 ```{=include=} sections auto-id-prefix=auto-generated
35 ${lib.concatMapStrings ({ name, baseName ? name, description }: ''
36 docgen ${name} ${baseName} ${lib.escapeShellArg description}
39 echo '```' >> "$out/index.md"