Skip to content

Commit 95f16a3

Browse files
committed
Don't override default man search paths
By appending a colon to MANPATH NIX_MAN_DIR gets prepended to the final MANPATH before default search paths. This makes man still consider default search paths, but prefers NIX_MAN_DIR (if it exists). It still makes sense to point NIX_MAN_DIR to a correct location by moving man pages build from nix-manual.man to nix-cli.man, but this should fix most common use-cases where nix is installed globally.
1 parent 9427c02 commit 95f16a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/nix/man-pages.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ std::filesystem::path getNixManDir()
1313
void showManPage(const std::string & name)
1414
{
1515
restoreProcessContext();
16-
setEnv("MANPATH", getNixManDir().c_str());
16+
setEnv("MANPATH", (getNixManDir().string() + ":").c_str());
1717
execlp("man", "man", name.c_str(), nullptr);
1818
if (errno == ENOENT) {
1919
// Not SysError because we don't want to suffix the errno, aka No such file or directory.

0 commit comments

Comments
 (0)