aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-12-16 23:33:01 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-12-16 23:33:01 +0000
commit194d21f9f63ceb034f3e8294f89aa6bf6a217bc9 (patch)
tree7eb6da5955482a82f4d34b60dcb10514a4a55f59 /src/libstore/globals.cc
parent3c3107da86ff71a08ce44027ee5899acf486796a (diff)
parent273b288a7e862ac1918064537ff130cc751fa9fd (diff)
* Sync with the trunk.
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 2e9dc8823..5c22f1406 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "globals.hh"
#include "util.hh"
@@ -138,5 +140,33 @@ void reloadSettings()
settings.clear();
}
+
+void setDefaultsFromEnvironment()
+{
+ /* Setup Nix paths. */
+ nixStore = canonPath(getEnv("NIX_STORE_DIR", getEnv("NIX_STORE", NIX_STORE_DIR)));
+ nixDataDir = canonPath(getEnv("NIX_DATA_DIR", NIX_DATA_DIR));
+ nixLogDir = canonPath(getEnv("NIX_LOG_DIR", NIX_LOG_DIR));
+ nixStateDir = canonPath(getEnv("NIX_STATE_DIR", NIX_STATE_DIR));
+ 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));
+
+ string subs = getEnv("NIX_SUBSTITUTERS", "default");
+ if (subs == "default") {
+ substituters.push_back(nixLibexecDir + "/nix/substituters/copy-from-other-stores.pl");
+ substituters.push_back(nixLibexecDir + "/nix/substituters/download-using-manifests.pl");
+ } else
+ substituters = tokenizeString(subs, ":");
+
+ /* Get some settings from the configuration file. */
+ thisSystem = querySetting("system", SYSTEM);
+ maxBuildJobs = queryIntSetting("build-max-jobs", 1);
+ buildCores = queryIntSetting("build-cores", 1);
+ maxSilentTime = queryIntSetting("build-max-silent-time", 0);
+ buildTimeout = queryIntSetting("build-timeout", 0);
+}
+
}