None of the nix-related command line tools (nix-build, nix-shell, etc) had command line help for me out of the box. This made it VERY user-unfriendly. Running nix-shell --help would give an error No manual entry for nix-shell.
It's been awhile since I installed nix so I don't remember exactly how I did it, but I think it was a pretty normal installation. I was sourcing $HOME/.nix-profile/etc/profile.d/nix.sh in my .zshrc file, but apparently that does not set MANPATH appropriately.
Manually adding ~/.nix-profile/share/man to my MANPATH fixed the problem, but this should probably be done out of the box.
Hmmm, I don't have my MANPATH set but it worked out of the box for me. That said, I didn't have the MANPATH variable set at all, did you have it set prior to adding that path? Could you try unsetting that and giving it a go?
Relevant: e7cd18e90709673de175d67d9d2033b26555640d
My MANPATH was set to something before, but it did not have ~/.nix-profile/share/man and it did not work. As soon as I added that directory to the path it started working.
I think adding something like the following to $HOME/.nix-profile/etc/profile.d/nix.sh should fix the issue you encountered:
if [ "$MANPATH" ]; then
export MANPATH=$HOME/.nix-profile/share/man:$MANPATH
fi
I am not sure if this is really the best way to address this though.
Yeah, that seems like it would fix it.
You can add an else branch to the conditional statement here: https://github.com/NixOS/nix/blob/master/scripts/nix-profile.sh.in#L84-L86
Ouch, it should already cover your case.
Please how what these lines look in your $HOME/.nix-profile/etc/profile.d/nix.sh
While that line looks like it should resolve this issue, it wasn't in my nix.sh and I am assuming it wasn't in @mightybyte's either.
I am using Nix on darwin so maybe that matters here.
Could you be suffering from https://github.com/NixOS/nixpkgs/issues/22318 ?
Hmm, actually if you use man from somewhere else than nixpkgs, you may experience different problems than with our version.
The reason why the default setup work for some, is because the debian version of man looks for the relative paths to the binary: ../man, man, ../share/man, or share/man.
You can see the messages when you do: man -d nix-env
The feature was introduced in 2.5.7-1, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=505465
Relevant function: https://github.com/giraldeau/man-db-2.6.3/blob/master/src/manp.c#L915-L926
And is also briefly mentioned in the changelog: http://metadata.ftp-master.debian.org/changelogs/main/m/man-db/unstable_changelog
Do what the user probably means when the full path to an executable is given as an argument (closes: #505465).
It seems that configuring the MANPATH is the easiest ways to not rely on that feature.
Just ran into this, and since nix install-script uses multi-user by default, I had to also put /nix/var/nix/profiles/default/share/man to MANPATH for the nix-* --help commands to work (since $HOME/.nix-profile symlinks to /nix/var/nix/profiles/per-user/[username]/profile by default that does not include mans for nix-env etc.).
macOS Sierra 10.12.6
nix-env (Nix) 1.11.16
@bobbypriambodo would you like to submit the patch?
@rasendubi I'd love to, but I'm not sure where it should go (just starting with nix), from what I'm reading it would seem that I need to put it into nix-daemon.sh? Since that's the one that gets sourced in /etc/profile instead of nix.sh.
@bobbypriambodo I would put this into nix-profile.sh.in. (not sure what nix-daemon.sh is used for)
I disagree with putting this in nix-profile*.sh. That script sets what is needed to run builds with the package manager. Man pages is a separate issue. As I wrote in https://github.com/NixOS/nix/pull/1782 we just got rid of ASPELL_PATH as well.
The solution is to build a derivation that wraps e.g. man and sets the env var accordingly, similar as what is done with aspell.
For user friendliness installers could be made that, as part of the installation process, would install these derivations.
The solution is to build a derivation that wraps e.g. man and sets the env var accordingly, similar as what is done with aspell.
Do you think we should also remove MANPATH from NixOS profile? Right now I think MANPATH is set somewhere in NixOS which is probably why more people aren't complaining about man not working. It would be nice to handle this entirely within nixpkgs so both NixOS and non-NixOS can benefit equally. There might be a technical reason why it's not possible though.
I know nix-env -iA nixos.man-old sets the path to work when installed and puts it back when you uninstall, if this helps. After the install, look in /nix/store/...-man-1.6g/lib/man.conf
(triage) IIUC the next step is to remove MANPATH from NixOS profiles, so that bugs surface correctly all the time and not only rarely, and so that they can be actually fixed. Is that correct?
I think manpath -q can be used instead of $MANPATH.
Roughly:
export MANPATH=$HOME/.nix-profile/share/man:$(manpath -q)
I'm not sure how portable it is, though.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Closing - this should happen in NixOS/nix, see https://github.com/NixOS/nix/pull/2565.
Most helpful comment
Do you think we should also remove MANPATH from NixOS profile? Right now I think MANPATH is set somewhere in NixOS which is probably why more people aren't complaining about man not working. It would be nice to handle this entirely within nixpkgs so both NixOS and non-NixOS can benefit equally. There might be a technical reason why it's not possible though.