about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-02-14T22·05-0600
committerMatthew Bauer <mjbauer95@gmail.com>2018-02-15T16·20-0600
commit8f186722a97882ba41330684f37bfe8b8637eba8 (patch)
tree71e6aa7022e8e1dfb0af30fc6ff0b671900c5a0f /src/libmain
parent96d48318cb838cb67916e443266210c46fe4bf87 (diff)
Set backup MANPATH in case man path isn’t set correctly.
Previously, this would fail at startup for non-NixOS installs:

nix-env --help

The fix for this is to just use "nixManDir" as the value for MANPATH
when spawning "man".

To test this, I’m using the following:

$ nix-build release.nix -A build
$ MANPATH= ./result/bin/nix-env --help

Fixes #1627
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 90a4867163df..7d888202bbf1 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -262,6 +262,7 @@ void printVersion(const string & programName)
 void showManPage(const string & name)
 {
     restoreSignals();
+    setenv("MANPATH", settings.nixManDir.c_str(), 1);
     execlp("man", "man", name.c_str(), NULL);
     throw SysError(format("command 'man %1%' failed") % name.c_str());
 }