From f530ee6f356f4299ca343dde7f4c0742300ffa08 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Aug 2014 18:00:00 +0200 Subject: [PATCH] =?UTF-8?q?Add=20option=20=E2=80=98build-extra-chroot-dirs?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is useful for extending (rather than overriding) the default set of chroot paths. --- nix/libstore/build.cc | 11 +++++++---- nix/libstore/globals.cc | 1 - nix/libstore/globals.hh | 4 ---- 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(settings.get(string("build-chroot-dirs"), DEFAULT_CHROOT_DIRS)); + PathSet dirs2 = tokenizeString(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;