about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-05T15·45+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-05T15·45+0200
commitbb50c8931934d04dbf61bd245b4583f8c1ac4fd9 (patch)
tree47d4dfef0da6ac7b2bd9cde3336b12f57a6a14aa /src/libstore/build.cc
parent465cb6824401541d82489e11b5223dbfd50bb132 (diff)
Make the location of the build directory in the sandbox configurable
This is mostly for use in the sandbox tests, since if the Nix store is
under /build, then we can't use /build as the build directory.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 6d20512e1f..70ecf4bad9 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"). */