NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.39k stars 14.34k forks source link

pcre2: man pages like `pcre2syntax` are not installed #348167

Open ilyagr opened 1 month ago

ilyagr commented 1 month ago

Describe the bug

I installed pcre2 with home-manager, mainly in order to have access to its man pages. Now, man pcre2test works. However, neither man pcre2 nor man pcre2syntax work.

Is there a recommended way to make those accessible?

It would be even better if those man pages were installed whenever pcre2 library was installed (even as a dependency), so they'd just be there when needed (e.g. when I read that some other program I installed uses the "PCRE2 regex syntax" for some purpose in its man page). I'm not sure how possible that is with Nix.

Workaround on a Mac: brew install pcre2. This does not work for tab completing man on fish for me, though.

Notify maintainers

@trofi @alyssais @ttuegel

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.7`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.24.9`
 - nixpkgs: `/nix/store/mln6wr5z539qgldmsm4j1k8k0dm19yvz-source`

Add a :+1: reaction to issues you find important.

qwqawawow commented 1 month ago

https://github.com/nix-community/home-manager/blob/d57112db877f07387ce7104b5ac346ede556d2d7/modules/programs/man.nix#L8 perhaps this option (This is not a nixpkgs issue)

ilyagr commented 1 month ago

Some manpages are installed correctly, e.g. pcre2test (which is a man page for a binary in the pcre2 package). However, the docs for the library (e.g. pcre2syntax) are not installed.

I believe, therefore, that this is a nixpkgs issue, as I believe the nixpkgs package defines which man pages are part of the package.

viraptor commented 1 month ago

The man pages for the cli tools (man1) are installed with pcre2.man, but the ones for the library/development (man3) are in pcre2.devdoc. Install both and you'll have access to both /nix/store/lpcrj32w4x8rd61z3ggp5j5s7hggaw6k-pcre2-10.44-man/share/man/man1/pcre2test.1.gz and /nix/store/l2n6ah16l0lyd6gavdm9z4bbsfrwnx6n-pcre2-10.44-devdoc/share/man/man3/pcre2syntax.3.gz.

(unless there are some extra issues on top of that - feel free to reopen if I missed something)

ilyagr commented 1 month ago

This feels a bit strange, since these docs are useful for end-users of programs using pcre2, more so than for developers. I guess nixpkgs might not have a convention for such docs.

In any case, this works and helps a lot, and now I know. Thank you!

ilyagr commented 1 month ago

Another issue is that I have no idea how I could have found out without asking. But, I guess, I knew about .man targets, so now I can just know to try .devdoc.

qwqawawow commented 1 month ago

Another issue is that I have no idea how I could have found out without asking. But, I guess, I knew about .man targets, so now I can just know to try .devdoc.

Maybe we can use nix-locate?

  $ nix-locate -r 'man/.*pcre2.*'

pcre2.devdoc                                      7,615 r /nix/store/zlbg60j42j4k1kz3c1xi8g8sghmqflm5-pcre2-10.44-devdoc/share/man/man3/pcre2jit.3.gz
pcre2.devdoc                                      1,525 r /nix/store/zlbg60j42j4k1kz3c1xi8g8sghmqflm5-pcre2-10.44-devdoc/share/man/man3/pcre2imits.3.gz
pcre2.devdoc                                      3,750 r /nix/store/zlbg60j42j4k1kz3c1xi8g8sghmqflm5-pcre2-10.44-devdoc/share/man/man3/pcre2matching.3.gz
viraptor commented 1 month ago

nix-locate is definitely what I'd recommend. Otherwise https://search.nixos.org/packages?channel=24.05&show=pcre2&from=0&size=50&sort=relevance&type=packages&query=pcre2 shows that the devdocs output exists in general.

But also according to https://nixos.org/manual/nixpkgs/stable/#outputdevman devdoc is the wrong place for man3 these days. I'll reopen and let the maintainers of that package decide if they want to move or not.

trofi commented 1 month ago

I think it's side-effect of devdoc presence in outputs. AFAIU it's a fallback location to devman output. man3 is moved here to devman: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/multiple-outputs.sh#L152