summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-17 15:18:13 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:32:30 +0200
commit55939b1a4b34b904eedba90ac6c14efc6258f40d (patch)
treeb048df770f6a4e27596f910092ff526d89006cb4 /nix
parent6621195e48f8e0cbbe6e19dbcde30bd8a7da0399 (diff)
downloadguix-55939b1a4b34b904eedba90ac6c14efc6258f40d.tar.gz
Settings: Add bool get()
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc4
-rw-r--r--nix/libstore/globals.cc8
-rw-r--r--nix/libstore/globals.hh2
3 files changed, 12 insertions, 2 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 6d90ce9c23..36c6ea8925 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1811,8 +1811,8 @@ void DerivationGoal::startBuilder()
 
         /* Bind-mount a user-configurable set of directories from the
            host file system. */
-        PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", DEFAULT_CHROOT_DIRS));
-        PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", ""));
+        PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", string(DEFAULT_CHROOT_DIRS)));
+        PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string("")));
         dirs.insert(dirs2.begin(), dirs2.end());
         for (auto & i : dirs) {
             size_t p = i.find('=');
diff --git a/nix/libstore/globals.cc b/nix/libstore/globals.cc
index 1cbe912625..bb08a7d0b0 100644
--- a/nix/libstore/globals.cc
+++ b/nix/libstore/globals.cc
@@ -130,6 +130,14 @@ Strings Settings::get(const string & name, const Strings & def)
 }
 
 
+bool Settings::get(const string & name, bool def)
+{
+    bool res = def;
+    _get(res, name);
+    return res;
+}
+
+
 void Settings::update()
 {
     _get(tryFallback, "build-fallback");
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 55f082e56e..c17e10d7c3 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -25,6 +25,8 @@ struct Settings {
 
     Strings get(const string & name, const Strings & def);
 
+    bool get(const string & name, bool def);
+
     void update();
 
     string pack();