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 @@ -2144,7 +2144,18 @@ void LocalDerivationGoal::runChild()
21442144 without file-write* allowed, access() incorrectly returns EPERM
21452145 */
21462146 sandboxProfile += " (allow file-read* file-write* process-exec\n " ;
2147+
2148+ // We create multiple allow lists, to avoid exceeding a limit in the darwin sandbox interpreter.
2149+ // See https://github.com/NixOS/nix/issues/4119
2150+ // We split our allow groups approximately at half the actual limit, 1 << 16
2151+ const int breakpoint = sandboxProfile.length () + (1 << 14 );
21472152 for (auto & i : pathsInChroot) {
2153+
2154+ if (sandboxProfile.length () >= breakpoint) {
2155+ debug (" Sandbox break: %d %d" , sandboxProfile.length (), breakpoint);
2156+ sandboxProfile += " )\n (allow file-read* file-write* process-exec\n " ;
2157+ }
2158+
21482159 if (i.first != i.second .source )
21492160 throw Error (
21502161 " 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