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.cc7
-rw-r--r--src/libstore/globals.hh3
-rw-r--r--src/libstore/machines.cc2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 6d20512e1f8e..70ecf4bad994 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1661,9 +1661,6 @@ int childEntry(void * arg)
 }
 
 
-const std::string buildDir = "/build";
-
-
 void DerivationGoal::startBuilder()
 {
     auto f = format(
@@ -1725,7 +1722,7 @@ void DerivationGoal::startBuilder()
     /* In a sandbox, for determinism, always use the same temporary
        directory. */
 #if __linux__
-    tmpDirInSandbox = useChroot ? buildDir : tmpDir;
+    tmpDirInSandbox = useChroot ? settings.sandboxBuildDir : tmpDir;
 #elif __APPLE__
     // On Darwin, we canonize /tmp because its probably a symlink to /private/tmp.
     tmpDirInSandbox = useChroot ? canonPath("/tmp", true) + "/nix-build-" + drvName + "-0" : tmpDir;
@@ -1843,7 +1840,7 @@ void DerivationGoal::startBuilder()
                 "root:x:0:0:Nix build user:%3%:/noshell\n"
                 "nixbld:x:%1%:%2%:Nix build user:%3%:/noshell\n"
                 "nobody:x:65534:65534:Nobody:/:/noshell\n",
-                sandboxUid, sandboxGid, buildDir));
+                sandboxUid, sandboxGid, settings.sandboxBuildDir));
 
         /* Declare the build user's group so that programs get a consistent
            view of the system (e.g., "id -gn"). */
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index ac6f6a2cfa36..7295b0d30af0 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -224,6 +224,9 @@ public:
 #if __linux__
     Setting<std::string> sandboxShmSize{this, "50%", "sandbox-dev-shm-size",
         "The size of /dev/shm in the build sandbox."};
+
+    Setting<Path> sandboxBuildDir{this, "/build", "sandbox-build-dir",
+        "The build directory inside the sandbox."};
 #endif
 
     Setting<PathSet> allowedImpureHostPrefixes{this, {}, "allowed-impure-host-deps",
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index c1d9047537d3..7491037b2d79 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -55,7 +55,7 @@ void parseMachines(const std::string & s, Machines & machines)
         if (sz < 1)
             throw FormatError("bad machine specification ‘%s’", line);
 
-        auto isSet = [&](int n) {
+        auto isSet = [&](size_t n) {
             return tokens.size() > n && tokens[n] != "" && tokens[n] != "-";
         };