summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-04 18:00:00 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:20:03 +0200
commitf530ee6f356f4299ca343dde7f4c0742300ffa08 (patch)
treecb06319d9c875363da5ba5b9dc5b05840502848d
parent75f746f018e34868b8057bed87c90d2cbe2c0b6c (diff)
downloadguix-f530ee6f356f4299ca343dde7f4c0742300ffa08.tar.gz
Add option ‘build-extra-chroot-dirs’
This is useful for extending (rather than overriding) the default set
of chroot paths.
-rw-r--r--nix/libstore/build.cc11
-rw-r--r--nix/libstore/globals.cc1
-rw-r--r--nix/libstore/globals.hh4
3 files changed, 7 insertions, 9 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 9b9f3d2b65..c73170e5d0 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1804,12 +1804,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/nix/libstore/globals.cc b/nix/libstore/globals.cc
index 21fbfba68b..b4c858bfef 100644
--- a/nix/libstore/globals.cc
+++ b/nix/libstore/globals.cc
@@ -131,7 +131,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/nix/libstore/globals.hh b/nix/libstore/globals.hh
index f1748336fd..7a81283fc0 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -142,10 +142,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;