emacs: set FD_SETSIZE and DARWIN_UNLIMITED_SELECT on darwin

This fixes the issue around macOS and `too many open files`.

Prior work:

https://github.com/d12frosted/homebrew-emacs-plus/commit/4b34ed7402a4f3e1f212b2c6fa0851f4b59e247c

Context:

https://en.liujiacai.net/2022/09/03/emacs-maxopenfiles/
This commit is contained in:
Jonathan Carroll Otsuka
2025-03-19 19:15:53 -05:00
parent 3f6e5ee4a8
commit 6a9b338960
@@ -460,10 +460,13 @@ mkDerivation (finalAttrs: {
NATIVE_FULL_AOT = "1";
LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths;
}
// lib.optionalAttrs (variant == "macport") {
# Fixes intermittent segfaults when compiled with LLVM >= 7.0.
# See https://github.com/NixOS/nixpkgs/issues/127902
NIX_CFLAGS_COMPILE = "-include ${./macport_noescape_noop.h}";
// {
NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [
# Fixes intermittent segfaults when compiled with LLVM >= 7.0.
# See https://github.com/NixOS/nixpkgs/issues/127902
(lib.optionalString (variant == "macport") "-include ${./macport_noescape_noop.h}")
(lib.optionalString stdenv.hostPlatform.isDarwin "-DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT")
];
};
enableParallelBuilding = true;