about summary refs log tree commit diff
path: root/src/libmain/shared.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-11-22T17·28+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-11-22T17·28+0000
commit993fa94fb489f46e127ef760bea8c65ef281ef7f (patch)
treeaa9072bc840449143362be8657a81092d2384dfa /src/libmain/shared.cc
parent4e1ea17052b4cc2445bc2ece2136f248112b4e45 (diff)
* Move initialisation of variables like nixConfDir from libmain to
  libstore so that the Perl bindings can use it as well.  It's vital
  that the Perl bindings use the configuration file, because otherwise
  nix-copy-closure will fail with a ‘database locked’ message if the
  value of ‘use-sqlite-wal’ is changed from the default.

Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r--src/libmain/shared.cc26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 8532cdaadcab..f7c11ed0544e 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -120,30 +120,8 @@ static bool showTrace = false;
    processor. */
 static void initAndRun(int argc, char * * argv)
 {
-    /* 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);
-
+    setDefaultsFromEnvironment();
+    
     /* Catch SIGINT. */
     struct sigaction act;
     act.sa_handler = sigintHandler;