3
0
Fork 0
forked from mirrors/nixpkgs

doc: inline doc-support to main drv

separating function docs out like this makes it less clear how library
documentation is generated and integrated into the build. if in the
future more parts of nixpkgs use nixdoc it will make sense to have all
information about library doc generation in the same place.
This commit is contained in:
pennae 2023-06-23 02:02:57 +02:00
parent 70cbd8c6c0
commit fc1b58b593
2 changed files with 18 additions and 31 deletions

View file

@ -3,7 +3,23 @@ let
inherit (pkgs) lib;
inherit (lib) hasPrefix removePrefix;
doc-support = import ./doc-support { inherit pkgs nixpkgs; };
lib-docs = import ./doc-support/lib-function-docs.nix {
inherit pkgs nixpkgs;
libsets = [
{ name = "asserts"; description = "assertion functions"; }
{ name = "attrsets"; description = "attribute set functions"; }
{ name = "strings"; description = "string manipulation functions"; }
{ name = "versions"; description = "version string functions"; }
{ name = "trivial"; description = "miscellaneous functions"; }
{ name = "lists"; description = "list manipulation functions"; }
{ name = "debug"; description = "debugging functions"; }
{ name = "options"; description = "NixOS / nixpkgs option handling"; }
{ name = "path"; description = "path functions"; }
{ name = "filesystem"; description = "filesystem functions"; }
{ name = "sources"; description = "source filtering functions"; }
{ name = "cli"; description = "command-line serialization functions"; }
];
};
epub = pkgs.runCommand "manual.epub" {
nativeBuildInputs = with pkgs; [ libxslt zip ];
@ -78,14 +94,13 @@ in pkgs.stdenv.mkDerivation {
src = ./.;
postPatch = ''
ln -s ${doc-support} ./doc-support/result
ln -s ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
'';
buildPhase = ''
cat \
./functions/library.md.in \
./doc-support/result/function-docs/index.md \
${lib-docs}/index.md \
> ./functions/library.md
substitute ./manual.md.in ./manual.md \
--replace '@MANUAL_VERSION@' '${pkgs.lib.version}'

View file

@ -1,28 +0,0 @@
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
let
libsets = [
{ name = "asserts"; description = "assertion functions"; }
{ name = "attrsets"; description = "attribute set functions"; }
{ name = "strings"; description = "string manipulation functions"; }
{ name = "versions"; description = "version string functions"; }
{ name = "trivial"; description = "miscellaneous functions"; }
{ name = "lists"; description = "list manipulation functions"; }
{ name = "debug"; description = "debugging functions"; }
{ name = "options"; description = "NixOS / nixpkgs option handling"; }
{ name = "path"; description = "path functions"; }
{ name = "filesystem"; description = "filesystem functions"; }
{ name = "sources"; description = "source filtering functions"; }
{ name = "cli"; description = "command-line serialization functions"; }
];
functionDocs = import ./lib-function-docs.nix { inherit pkgs nixpkgs libsets; };
in pkgs.runCommand "doc-support" {}
''
mkdir result
(
cd result
ln -s ${functionDocs} ./function-docs
)
mv result $out
''