about summary refs log tree commit diff
path: root/src/libstore
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/libstore
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/libstore')
-rw-r--r--src/libstore/globals.cc1
-rw-r--r--src/libstore/globals.hh3
-rw-r--r--src/libstore/local.mk1
3 files changed, 5 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index c6b508cbe82f..247040606fb7 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -38,6 +38,7 @@ Settings::Settings()
     , nixConfDir(canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR)))
     , nixLibexecDir(canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR)))
     , nixBinDir(canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR)))
+    , nixManDir(canonPath(NIX_MAN_DIR))
     , nixDaemonSocketFile(canonPath(nixStateDir + DEFAULT_SOCKET_PATH))
 {
     buildUsersGroup = getuid() == 0 ? "nixbld" : "";
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 508084d08acb..fd3fbec9f017 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -82,6 +82,9 @@ public:
     /* The directory where the main programs are stored. */
     Path nixBinDir;
 
+    /* The directory where the man pages are stored. */
+    Path nixManDir;
+
     /* File name of the socket the daemon listens to.  */
     Path nixDaemonSocketFile;
 
diff --git a/src/libstore/local.mk b/src/libstore/local.mk
index 239356aee8dc..c7ac534e2383 100644
--- a/src/libstore/local.mk
+++ b/src/libstore/local.mk
@@ -38,6 +38,7 @@ libstore_CXXFLAGS = \
  -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
  -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
  -DNIX_BIN_DIR=\"$(bindir)\" \
+ -DNIX_MAN_DIR=\"$(mandir)\" \
  -DSANDBOX_SHELL="\"$(sandbox_shell)\"" \
  -DLSOF=\"$(lsof)\"