File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2222,7 +2222,18 @@ void LocalDerivationGoal::runChild()
22222222 without file-write* allowed, access() incorrectly returns EPERM
22232223 */
22242224 sandboxProfile += " (allow file-read* file-write* process-exec\n " ;
2225+
2226+ // We create multiple allow lists, to avoid exceeding a limit in the darwin sandbox interpreter.
2227+ // See https://github.com/NixOS/nix/issues/4119
2228+ // We split our allow groups approximately at half the actual limit, 1 << 16
2229+ const int breakpoint = sandboxProfile.length () + (1 << 14 );
22252230 for (auto & i : pathsInChroot) {
2231+
2232+ if (sandboxProfile.length () >= breakpoint) {
2233+ debug (" Sandbox break: %d %d" , sandboxProfile.length (), breakpoint);
2234+ sandboxProfile += " )\n (allow file-read* file-write* process-exec\n " ;
2235+ }
2236+
22262237 if (i.first != i.second .source )
22272238 throw Error (
22282239 " can't map '%1%' to '%2%': mismatched impure paths not supported on Darwin" ,
You can’t perform that action at this time.
0 commit comments