1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

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.
This commit is contained in:
Eelco Dolstra 2017-05-05 17:45:22 +02:00
parent 465cb68244
commit bb50c89319
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 12 additions and 8 deletions

View file

@ -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"). */