diff --git a/pkgs/applications/terminal-emulators/kitty/apple-sdk-11.patch b/pkgs/applications/terminal-emulators/kitty/apple-sdk-11.patch new file mode 100644 index 0000000000000..ca7dd8242a795 --- /dev/null +++ b/pkgs/applications/terminal-emulators/kitty/apple-sdk-11.patch @@ -0,0 +1,44 @@ +diff --git a/setup.py b/setup.py +index a9138efe..54172eb9 100755 +--- a/setup.py ++++ b/setup.py +@@ -14,6 +14,7 @@ + import sys + import sysconfig + import platform ++import tempfile + import time + from contextlib import suppress + from functools import partial +@@ -229,18 +230,19 @@ def get_sanitize_args(cc: str, ccver: Tuple[int, int]) -> List[str]: + + def test_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: str = 'c') -> bool: + src = src or 'int main(void) { return 0; }' +- p = subprocess.Popen( +- [cc] + list(cflags) + ['-x', lang, '-o', os.devnull, '-'], +- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.PIPE, +- ) +- stdin = p.stdin +- assert stdin is not None +- try: +- stdin.write(src.encode('utf-8')) +- stdin.close() +- except BrokenPipeError: +- return False +- return p.wait() == 0 ++ with tempfile.TemporaryDirectory() as tdir: ++ p = subprocess.Popen( ++ [cc] + list(cflags) + ['-x', lang, '-o', os.path.join(tdir, 'dummy'), '-'], ++ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.PIPE, ++ ) ++ stdin = p.stdin ++ assert stdin is not None ++ try: ++ stdin.write(src.encode('utf-8')) ++ stdin.close() ++ except BrokenPipeError: ++ return False ++ return p.wait() == 0 + + + def first_successful_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: str = 'c') -> str: diff --git a/pkgs/applications/terminal-emulators/kitty/default.nix b/pkgs/applications/terminal-emulators/kitty/default.nix index 4cd8f72b790fa..22b9355460ff7 100644 --- a/pkgs/applications/terminal-emulators/kitty/default.nix +++ b/pkgs/applications/terminal-emulators/kitty/default.nix @@ -5,6 +5,7 @@ lcms2, installShellFiles, dbus, + darwin, Cocoa, CoreGraphics, Foundation, @@ -45,6 +46,8 @@ buildPythonApplication rec { libpng python3 zlib + ] ++ lib.optionals (stdenv.isDarwin && (builtins.hasAttr "UserNotifications" darwin.apple_sdk.frameworks)) [ + darwin.apple_sdk.frameworks.UserNotifications ] ++ lib.optionals stdenv.isLinux [ fontconfig libunistring libcanberra libX11 libXrandr libXinerama libXcursor libxkbcommon libXi libXext @@ -67,6 +70,8 @@ buildPythonApplication rec { propagatedBuildInputs = lib.optional stdenv.isLinux libGL; + patches = lib.optionals stdenv.isDarwin [ ./apple-sdk-11.patch ]; + outputs = [ "out" "terminfo" ]; # Causes build failure due to warning