about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc11
-rw-r--r--src/libstore/globals.cc4
-rw-r--r--src/libstore/globals.hh4
-rw-r--r--src/libstore/local.mk3
4 files changed, 9 insertions, 13 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index e3d96d931ff9..5c672227bca4 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1792,12 +1792,15 @@ void DerivationGoal::startBuilder()
 
         /* Bind-mount a user-configurable set of directories from the
            host file system. */
-        foreach (StringSet::iterator, i, settings.dirsInChroot) {
-            size_t p = i->find('=');
+        PathSet dirs = tokenizeString<StringSet>(settings.get(string("build-chroot-dirs"), DEFAULT_CHROOT_DIRS));
+        PathSet dirs2 = tokenizeString<StringSet>(settings.get(string("build-extra-chroot-dirs"), ""));
+        dirs.insert(dirs2.begin(), dirs2.end());
+        for (auto & i : dirs) {
+            size_t p = i.find('=');
             if (p == string::npos)
-                dirsInChroot[*i] = *i;
+                dirsInChroot[i] = i;
             else
-                dirsInChroot[string(*i, 0, p)] = string(*i, p + 1);
+                dirsInChroot[string(i, 0, p)] = string(i, p + 1);
         }
         dirsInChroot[tmpDir] = tmpDir;
 
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 77f25005b85f..3e8c2c636054 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -48,9 +48,6 @@ Settings::Settings()
     useSubstitutes = true;
     buildUsersGroup = getuid() == 0 ? "nixbld" : "";
     useChroot = false;
-#ifdef DEFAULT_CHROOT_DIRS
-    dirsInChroot = tokenizeString<StringSet>(DEFAULT_CHROOT_DIRS, ":");
-#endif
     useSshSubstituter = true;
     impersonateLinux26 = false;
     keepLog = true;
@@ -148,7 +145,6 @@ void Settings::update()
     get(useSubstitutes, "build-use-substitutes");
     get(buildUsersGroup, "build-users-group");
     get(useChroot, "build-use-chroot");
-    get(dirsInChroot, "build-chroot-dirs");
     get(impersonateLinux26, "build-impersonate-linux-26");
     get(keepLog, "build-keep-log");
     get(compressLog, "build-compress-log");
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index d16969c9e010..c3baca2046a3 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -144,10 +144,6 @@ struct Settings {
     /* Whether to build in chroot. */
     bool useChroot;
 
-    /* The directories from the host filesystem to be included in the
-       chroot. */
-    StringSet dirsInChroot;
-
     /* Set of ssh connection strings for the ssh substituter */
     Strings sshSubstituterHosts;
 
diff --git a/src/libstore/local.mk b/src/libstore/local.mk
index 64dbfa3c5b0e..180088d3df8c 100644
--- a/src/libstore/local.mk
+++ b/src/libstore/local.mk
@@ -21,7 +21,8 @@ libstore_CXXFLAGS = \
  -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \
  -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
  -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
- -DNIX_BIN_DIR=\"$(bindir)\"
+ -DNIX_BIN_DIR=\"$(bindir)\" \
+ -DDEFAULT_CHROOT_DIRS="\"$(DEFAULT_CHROOT_DIRS)\""
 
 $(d)/local-store.cc: $(d)/schema.sql.hh