mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
macOS: Ugly hack to make the tests succeed
Sandboxes cannot be nested, so if Nix's build runs inside a sandbox,
it cannot use a sandbox itself. I don't see a clean way to detect
whether we're in a sandbox, so use a test-specific hack.
https://github.com/NixOS/nix/issues/1413
(cherry picked from commit 1888f7889b)
This commit is contained in:
parent
3e574c3691
commit
11dd08f02e
2 changed files with 6 additions and 3 deletions
|
|
@ -2542,7 +2542,7 @@ void DerivationGoal::runChild()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
else {
|
else if (getEnv("_NIX_TEST_NO_SANDBOX") == "") {
|
||||||
/* This has to appear before import statements. */
|
/* This has to appear before import statements. */
|
||||||
std::string sandboxProfile = "(version 1)\n";
|
std::string sandboxProfile = "(version 1)\n";
|
||||||
|
|
||||||
|
|
@ -2650,13 +2650,12 @@ void DerivationGoal::runChild()
|
||||||
args.push_back("_GLOBAL_TMP_DIR=" + globalTmpDir);
|
args.push_back("_GLOBAL_TMP_DIR=" + globalTmpDir);
|
||||||
args.push_back(drv->builder);
|
args.push_back(drv->builder);
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
else {
|
else {
|
||||||
builder = drv->builder.c_str();
|
builder = drv->builder.c_str();
|
||||||
string builderBasename = baseNameOf(drv->builder);
|
string builderBasename = baseNameOf(drv->builder);
|
||||||
args.push_back(builderBasename);
|
args.push_back(builderBasename);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto & i : drv->args)
|
for (auto & i : drv->args)
|
||||||
args.push_back(rewriteHashes(i, rewritesToTmp));
|
args.push_back(rewriteHashes(i, rewritesToTmp));
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ export NIX_DB_DIR=$TEST_ROOT/db
|
||||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||||
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
|
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
|
||||||
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
||||||
|
if [[ -n $NIX_STORE ]]; then
|
||||||
|
export _NIX_TEST_NO_SANDBOX=1
|
||||||
|
fi
|
||||||
|
export _NIX_IN_TEST=$TEST_ROOT/shared
|
||||||
export NIX_REMOTE=$NIX_REMOTE_
|
export NIX_REMOTE=$NIX_REMOTE_
|
||||||
|
|
||||||
export PATH=@bindir@:$PATH
|
export PATH=@bindir@:$PATH
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue