I can find the document of texlive packages under /nix/store/.*-texlive-.*\.doc. But I cannot use texdoc to open a helping document quickly. It listed error as following:
$ texdoc texdoc /nix/store/cph70fq2lhhjilgnms45pjw3r5pl5rpk-texlive-texdoc.doc-3.2.1/doc/support/texdoc
texdoc error: No texlive.tlpdb nor shipped tlpdb data found.
I find overrides of texlive.tlpdb commented in <nixpkgs/pkgs/tools/typesetting/tex/texlive/default.nix>. Dose this means I cannot use texdoc installed by nix? Or what should I do to make it work.
call texlive.combine with a custom pkgFilter so that it install packages with tlType == "doc" (you should only allow "doc" for the packages you really need – the docs take a tons of space and are not cached, so you’ll have to build them locally),
I haven’t tried, but in principle, it should work.
Ideally, nixpkgs should ship the file Data.tlpdb.lua together with texdoc (here are the commands to generate it texdoc/Rakefile at a16bef1b0a978fd0cbc88b3ad0887cbc08c07a1a · TeX-Live/texdoc · GitHub) so that you can skip steps 1 and 3. The hard part, for me at least, is figuring out where to do this in texlive. Maybe this could be a fake package, forced in as an additional dependency of texdoc.
$ texdoc -c texlive_tlpdb=texlive.tlpdb -l texdoc
1 /nix/store/xs5s9bpna1854zfc01zpr2wahyw1chc3-texlive-combined-2021/share/texmf/doc/support/texdoc/texdoc.pdf
= Package documentation
2 /nix/store/xs5s9bpna1854zfc01zpr2wahyw1chc3-texlive-combined-2021/share/texmf/doc/support/texdoc/README.md
= Readme
3 /nix/store/xs5s9bpna1854zfc01zpr2wahyw1chc3-texlive-combined-2021/share/texmf/doc/support/texdoc/NEWS
4 /nix/store/xs5s9bpna1854zfc01zpr2wahyw1chc3-texlive-combined-2021/share/texmf/doc/man/man1/texdoc.man1.pdf
Enter number of file to view, RET to view 1, anything else to skip: 2
Ah, I didn’t notice your message until now, sorry. For future reference: texdoc works out of the box in nixpkgs unstable and soon 21.11. You still need to use texlive.combine with a custom pkgFilter to install the doc files. Once you do that, you can simply call texdoc as usual.