From 1e16d2065503e213189d58db14de893f51545597 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Dec 2006 13:09:16 +0000 Subject: [PATCH] * Install the worker in bindir, not libexecdir. * Allow the worker path to be overriden through the NIX_WORKER environment variable. --- src/libmain/Makefile.am | 1 + src/libmain/shared.cc | 1 + src/libstore/globals.cc | 1 + src/libstore/globals.hh | 3 +++ src/libstore/remote-store.cc | 5 ++++- src/nix-worker/Makefile.am | 2 +- 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libmain/Makefile.am b/src/libmain/Makefile.am index 7df4f4b05..e5d199e2c 100644 --- a/src/libmain/Makefile.am +++ b/src/libmain/Makefile.am @@ -9,6 +9,7 @@ AM_CXXFLAGS = \ -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \ -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ + -DNIX_BIN_DIR=\"$(bindir)\" \ -DNIX_VERSION=\"$(VERSION)\" \ -I$(srcdir)/.. ${aterm_include} -I$(srcdir)/../libutil \ -I$(srcdir)/../libstore diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 68016b0d7..e6713e9ab 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -91,6 +91,7 @@ static void initAndRun(int argc, char * * argv) nixDBPath = getEnv("NIX_DB_DIR", nixStateDir + "/db"); 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)); /* Get some settings from the configuration file. */ thisSystem = querySetting("system", SYSTEM); diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 466d0e0b2..e8c033db2 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -15,6 +15,7 @@ string nixStateDir = "/UNINIT"; string nixDBPath = "/UNINIT"; string nixConfDir = "/UNINIT"; string nixLibexecDir = "/UNINIT"; +string nixBinDir = "/UNINIT"; bool keepFailed = false; bool keepGoing = false; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index b93f5d62c..fbb9e19d6 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -32,6 +32,9 @@ extern string nixConfDir; stored. */ extern string nixLibexecDir; +/* nixBinDir is the directory where the main programs are stored. */ +extern string nixBinDir; + /* Misc. global flags. */ diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 0ed96bd23..d8b629af6 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -3,6 +3,7 @@ #include "remote-store.hh" #include "worker-protocol.hh" #include "archive.hh" +#include "globals.hh" #include #include @@ -27,7 +28,9 @@ RemoteStore::RemoteStore() /* Start the worker. */ - string worker = "nix-worker"; + Path worker = getEnv("NIX_WORKER"); + if (worker == "") + worker = nixBinDir + "/nix-worker"; child = fork(); diff --git a/src/nix-worker/Makefile.am b/src/nix-worker/Makefile.am index b499d0d81..1be7e3d54 100644 --- a/src/nix-worker/Makefile.am +++ b/src/nix-worker/Makefile.am @@ -1,4 +1,4 @@ -libexec_PROGRAMS = nix-worker +bin_PROGRAMS = nix-worker nix_worker_SOURCES = main.cc help.txt nix_worker_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \