-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix-shell: set MANPATH when --packages is used #4642
base: master
Are you sure you want to change the base?
Conversation
Setting MANPATH allows man viewers to reliably find man pages which are contained in the store paths of the packages passed to nix-shell -p. Running nix-shell -p package --run "man package" is something that one generally would assume should work which this change allows for. Currently nix-shell -p package --run "man somepage" only works occasionally and only due to a behavior of GNU's man-db that is not documented: It tries to guess the man directory corresponding to every entry in PATH which only works if the packages added to nix-shell have a `bin` directory that gets added to PATH and is not supported by other man page viewers like mandoc. The simplest way to achieve this is setting MANPATH in the derivation and utilizing lib.makeSearchPath and lib.getOutput to construct the actual MANPATH. For outputs, we consider the `man` and `devman` outputs and fall back to `out` if they are missing (the current code results in a duplicate entries for many packages in MANPATH for the sake of simplicity).
dc31a6e
to
67fdd9a
Compare
Fixes syntax error introduced in 54ced90.
67fdd9a
to
883f890
Compare
I'd prefer to change this from |
Sounds like a good idea. I've drafted this for now anyways since it probably makes little sense to add this to However with how Installables currently work it is hard to implement this since the I'll see when I have time to have a look at |
Not sure I agree with that. If we pull in documentation outputs (which could be large) by default, it negates the advantage of separate outputs. Also, I feel |
This is a fair point, but I find it a bit difficult to judge the impact of this. I've briefly checked all top-level attributes of nixpkgs which have either a On the other hand the intention of the
I am generally inclined to agree and a setup hook would be useful for the current As a side note, I'd say A solution I could imagine which would work for |
To follow up on this: I've implemented the equivalent feature for the As for |
I marked this as stale due to inactivity. → More info |
Setting MANPATH allows man viewers to reliably find man pages which are
contained in the store paths of the packages passed to nix-shell -p.
Running nix-shell -p package --run "man package" is something that
one generally would assume should work which this change allows for.
Currently nix-shell -p package --run "man somepage" only works
occasionally and only due to a behavior of GNU's man-db that is not
documented: It tries to guess the man directory corresponding to every
entry in PATH which only works if the packages added to nix-shell have a
bin
directory that gets added to PATH and is not supported by otherman page viewers like mandoc.
The simplest way to achieve this is setting MANPATH in the derivation
and utilizing lib.makeSearchPath and lib.getOutput to construct the
actual MANPATH. For outputs, we consider the
man
anddevman
outputsand fall back to
out
if they are missing (the current code results ina duplicate entries for many packages in MANPATH for the sake of
simplicity).
I'm also interested in implementing this for
nix shell
, however sinceInstallables
are always just the default output (i. e.drv."${drv.outputName}"
) this is trickier since we'd also need theman
or evendevman
output to implement this correctly.