Repository: kovidgoyal/kitty

Issue:
Build system help
I'm on macOS 10.13.6 because of my hardware.
I'm getting an error when building Kitty.app about `UserNotifications.h` not being found.
The changelog for 0.19 mentions the new notification framework which seems like the likely culprit.
A little perusal of the source shows there's [an ifdef for people in a similar situation](https://github.com/kovidgoyal/kitty/blob/master/kitty/cocoa_window.m#L12).

Here comes the question. I can't find any documentation on how to specify this value. Do I set an env var or do I need to pass it to setup.py?


Discussion:
I added the ifdef and it basically just worked for me. But I didn't actually test this on macOS 10.13 but just with the old SDK instead.
How are you compiling kitty?
Look in `setup.py` and search for `KITTY_USE_DEPRECATED_MACOS_NOTIFICATION_API`. It compiles a trivial program and checks if there is an error message. If there is, it chooses the old notification API else the new one. Add two `print()` statements in `setup.py` and see which case is taken.
It's supposed to be detected automatically?

It's being built via nix. These are the commands being run to build:
```
    ${python.interpreter} setup.py kitty.app --update-check-interval=0
    make man
```

And here's the log:
```
building '/nix/store/6pgw2jp4klhf0hh3nkdavmdijmb3j985-kitty-0.19.1.drv'...
building '/nix/store/vpi94fq88k2a5sws953n3c7s895k8gad-xmlsec-1.2.30.drv'...
unpacking sources
unpacking source archive /nix/store/plmn9vcak5biq9akalg29z0fsip5vhvk-xmlsec1-1.2.30.tar.gz
source root is xmlsec1-1.2.30
setting SOURCE_DATE_EPOCH to timestamp 1587407484 of file xmlsec1-1.2.30/xmlsec1Conf.sh
patching sources
applying patch /nix/store/di8adg893w26yjydxns6clb0g6y7x4qd-lt_dladdsearchdir.patch
patching file src/dl.c
configuring
fixing libtool script ./ltmain.sh
configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30 --bindir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/bin --sbindir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/sbin --includedir=/nix/store/jizh70k6hln4y8cdwp89mjafy7dnl1n7-xmlsec-1.2.30-dev/include --oldincludedir=/nix/store/jizh70k6hln4y8cdwp89mjafy7dnl1n7-xmlsec-1.2.30-dev/include --mandir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/share/man --infodir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/share/info --docdir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/share/doc/xmlsec1 --libdir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/lib --libexecdir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/libexec --localedir=/nix/store/98905wng55hpjbcgzfn2h0pphm5syxsm-xmlsec-1.2.30/share/locale --enable-soap
Sourcing python-recompile-bytecode-hook.sh
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
checking build system type... x86_64-apple-darwin17.7.0
checking host system type... x86_64-apple-darwin17.7.0
checking for a BSD-compatible install... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '501' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
unpacking sources
unpacking source archive /nix/store/crq8b0kgfdx3y83n5yya6r8cdv580dyc-source
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
source root is source
checking for suffix of executables... 
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/update-on-ubuntu
patching sources
applying patch /nix/store/0q5p14wx5f6vg0aabnajzjgwrm3n58f9-print.patch
patching file setup.py
applying patch /nix/store/vzhr87xqnj7l8vxnmc2syzs9548nv0xj-fix-paths.patch
patching file docs/Makefile
building
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking whether clang understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of clang... none
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /nix/store/1srjhrzc3gb0g050vqxc4a81y1j5w1kg-gnugrep-3.4/bin/grep
checking for egrep... /nix/store/1srjhrzc3gb0g050vqxc4a81y1j5w1kg-gnugrep-3.4/bin/grep -E
CC: clang (4, 2)
checking for ANSI C header files... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /nix/store/9z7rc09qr2j09smg1jyjbck7j393k668-gnused-4.8/bin/sed
checking for fgrep... /nix/store/1srjhrzc3gb0g050vqxc4a81y1j5w1kg-gnugrep-3.4/bin/grep -F
checking for ld used by clang... ld
checking if the linker (ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... nm
-framework UserNotifications
!!!!!!!!YES
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin17.7.0 file names to x86_64-apple-darwin17.7.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin17.7.0 file names to toolchain format... func_convert_file_noop
checking for ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse nm output from clang object... ok
checking for sysroot... no
checking for a working dd... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/dd
checking how to truncate binary pipes... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... no
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if clang supports -fno-rtti -fno-exceptions... yes
checking for clang option to produce PIC... -fno-common -DPIC
checking if clang PIC flag -fno-common -DPIC works... yes
checking if clang static flag -static works... no
checking if clang supports -c -o file.o... yes
checking if clang supports -c -o file.o... (cached) yes
checking whether the clang linker (ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for cp... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/cp
checking for mv... /nix/store/2bbkv1njq1l6kyy93nvb3990wgmlkryv-coreutils-8.31/bin/mv
checking for tar... /nix/store/fpslrh41b6yfjqk6dwzk5ky7c8qn7fcd-gnutar-1.32/bin/tar
checking for perl... no
checking for help2man... no
checking for xsltproc... /nix/store/88rg1f1rsacpsz48vhnvfz2a1701dngr-libxslt-1.1.34-bin/bin/xsltproc
checking for man2html... no
checking for gtkdoc-mkhtml... no
checking for gtkdoc-mkdb... no
checking for gtkdoc-scan... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for ANSI C header files... (cached) yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
[30/56] Compiling [cocoa] glfw/vulkan.c ... done...
Compiling kitty/cocoa_window.m ...
clang -MMD -DNDEBUG -DPRIMARY_VERSION=4000 -DSECONDARY_VERSION=19 -DGL_SILENCE_DEPRECATION -Wextra -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11 -pedantic-errors -Werror -O3 -fwrapv -fstack-protector-strong -pipe -march=native -fvisibility=hidden -D_FORTIFY_SOURCE=2 -pthread -I/nix/store/y0i2ki3i32b2rfvmzaaq85k40k5lwqmc-zlib-1.2.11-dev/include -I/nix/store/9c010n7a2qj0yh051gdiggpbxrnwvjcn-libpng-apng-1.6.37-dev/include/libpng16 -I/nix/store/1p7yn53h6457z17javkaq6ri1lp2wa4p-lcms2-2.11-dev/include -I/nix/store/l1gg7dsdg042djzgqgz84s95lqkzgd3n-harfbuzz-2.7.1-dev/include/harfbuzz -I/nix/store/cp9nlaz4a24n8sp9f738ngdnrd19s4rp-python3-3.8.5/include/python3.8 -c kitty/cocoa_window.m -o build/fast_data_types-cocoa_window.m.o
checking ansidecl.h usability... no
checking ansidecl.h presence... no
checking for ansidecl.h... no
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for strchr... yes
kitty/cocoa_window.m:13:10: fatal error: 'UserNotifications/UserNotifications.h' file not found
#include <UserNotifications/UserNotifications.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
builder for '/nix/store/6pgw2jp4klhf0hh3nkdavmdijmb3j985-kitty-0.19.1.drv' failed with exit code 1
cannot build derivation '/nix/store/4krz7yxfhbn0cyw6ya6spmlvszbz5l53-home-manager-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/02r2744lgh3sc8r0f9fxi966n243i5s4-kitty-0.19.1-fish-completions.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/60q32nxsrx0vc48dbzpg478rs4iwb9hm-home-manager-generation.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ap7hla009sah5r0z4zyk0c1jphfb00s8-activation-toonn.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/63kcdligpkyrm92mipisv4sfwf85yrb2-darwin-system-21.03pre246624.cfed29bfcb2+darwin4.0000000.drv': 1 dependencies couldn't be built
error: build of '/nix/store/63kcdligpkyrm92mipisv4sfwf85yrb2-darwin-system-21.03pre246624.cfed29bfcb2+darwin4.0000000.drv' failed
```

These two lines are from print statements I added and show the wrong branch is being taken:
```
-framework UserNotifications  # <- value of "user_notifications_framework"
!!!!!!!!YES   # <- wrong branch
```
Yes, it's supposed to be detected automatically.
I made this change specifically for nix, since it still uses the macOS 10.12 SDK and it works fine on my machine. The only reason I can imagine why this would fail is if the `UserNotifications` framework exists but the `UserNotifications/UserNotifications.h` header doesn't for some reason. I made a commit that may fix it.
Try this:
- checkout https://github.com/Luflosi/kitty/commit/daed50feda0fa9ac1d5d683aab7530b43a99ed90
- execute `nix-shell --pure`
- execute `python3 setup.py kitty.app --update-check-interval=0`
- see if the kitty app launches ok

Please also test if the way you were trying to compile it earlier works too.
If it works, I'll clean the code up a little and make a PR.
It's building and it took the correct branch this time. I'll report whether the app works fine as soon as I can test.
Oh, actually. The build is failing because of xmlsec, a dependency I guess?

I'm not sure if this is on kitty though, might just be nixpkgs has a bad version of xmlsec on unstable at the moment.

Truncated log because it's way too many similar blocks:
```
Error: failed to parse xml file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to load template "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to decrypt file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Test: /nist-aesgcm/aes256/aes256-gcm-96-408-0-128-14 (success)
/private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 check-transforms  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config aes256-gcm
Transforms "aes256-gcm" found
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 decrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-14.xml
=== TEST RESULT: 0; expected: success
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 encrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml --binary-data /tmp/testEnc.sh.20201018_194954-33598.tmp.3 --output /tmp/testEnc.sh.20201018_194954-33598.tmp /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-14.tmpl
func=xmlSecOpenSSLEvpBlockCipherCtxUpdateBlock:file=ciphers.c:line=183:obj=unknown:subj=in != NULL:error=100:assertion: 
func=xmlSecOpenSSLEvpBlockCipherGCMCtxFinal:file=ciphers.c:line=523:obj=aes256-gcm:subj=xmlSecOpenSSLEvpBlockCipherCtxUpdateBlock:error=1:xmlsec library function failed: 
func=xmlSecOpenSSLEvpBlockCipherExecute:file=ciphers.c:line=844:obj=aes256-gcm:subj=xmlSecOpenSSLEvpBlockCipherCtxFinal:error=1:xmlsec library function failed: 
func=xmlSecTransformDefaultPushBin:file=transforms.c:line=1929:obj=aes256-gcm:subj=xmlSecTransformExecute:error=1:xmlsec library function failed:final=1
func=xmlSecTransformPump:file=transforms.c:line=1414:obj=aes256-gcm:subj=xmlSecTransformPushBin:error=1:xmlsec library function failed: 
func=xmlSecTransformCtxUriExecute:file=transforms.c:line=997:obj=input-uri:subj=xmlSecTransformPump:error=1:xmlsec library function failed: 
func=xmlSecTransformCtxExecute:file=transforms.c:line=1101:obj=unknown:subj=xmlSecTransformCtxUriExecute:error=1:xmlsec library function failed: 
func=xmlSecEncCtxUriEncrypt:file=xmlenc.c:line=488:obj=unknown:subj=xmlSecTransformCtxExecute:error=1:xmlsec library function failed: 
Error: failed to encrypt file "/tmp/testEnc.sh.20201018_194954-33598.tmp.3"
Error: failed to encrypt file with template "/private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-14.tmpl"
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 decrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml --output /tmp/testEnc.sh.20201018_194954-33598.tmp.2 /tmp/testEnc.sh.20201018_194954-33598.tmp
I/O warning : failed to load external entity "/tmp/testEnc.sh.20201018_194954-33598.tmp"
func=xmlSecParseFile:file=parser.c:line=373:obj=unknown:subj=xmlCreateFileParserCtxt:error=5:libxml2 library function failed:filename=/tmp/testEnc.sh.20201018_194954-33598.tmp; xml error: 1549: failed to load external entity "/tmp/testEnc.sh.20201018_194954-33598.tmp"

Error: failed to parse xml file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to load template "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to decrypt file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Test: /nist-aesgcm/aes256/aes256-gcm-96-408-0-128-15 (success)
/private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 check-transforms  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config aes256-gcm
Transforms "aes256-gcm" found
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 decrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-15.xml
=== TEST RESULT: 0; expected: success
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 encrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml --binary-data /tmp/testEnc.sh.20201018_194954-33598.tmp.3 --output /tmp/testEnc.sh.20201018_194954-33598.tmp /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-15.tmpl
func=xmlSecOpenSSLEvpBlockCipherCtxUpdateBlock:file=ciphers.c:line=183:obj=unknown:subj=in != NULL:error=100:assertion: 
func=xmlSecOpenSSLEvpBlockCipherGCMCtxFinal:file=ciphers.c:line=523:obj=aes256-gcm:subj=xmlSecOpenSSLEvpBlockCipherCtxUpdateBlock:error=1:xmlsec library function failed: 
func=xmlSecOpenSSLEvpBlockCipherExecute:file=ciphers.c:line=844:obj=aes256-gcm:subj=xmlSecOpenSSLEvpBlockCipherCtxFinal:error=1:xmlsec library function failed: 
func=xmlSecTransformDefaultPushBin:file=transforms.c:line=1929:obj=aes256-gcm:subj=xmlSecTransformExecute:error=1:xmlsec library function failed:final=1
func=xmlSecTransformPump:file=transforms.c:line=1414:obj=aes256-gcm:subj=xmlSecTransformPushBin:error=1:xmlsec library function failed: 
func=xmlSecTransformCtxUriExecute:file=transforms.c:line=997:obj=input-uri:subj=xmlSecTransformPump:error=1:xmlsec library function failed: 
func=xmlSecTransformCtxExecute:file=transforms.c:line=1101:obj=unknown:subj=xmlSecTransformCtxUriExecute:error=1:xmlsec library function failed: 
func=xmlSecEncCtxUriEncrypt:file=xmlenc.c:line=488:obj=unknown:subj=xmlSecTransformCtxExecute:error=1:xmlsec library function failed: 
Error: failed to encrypt file "/tmp/testEnc.sh.20201018_194954-33598.tmp.3"
Error: failed to encrypt file with template "/private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/aes256/aes256-gcm-96-408-0-128-15.tmpl"
 /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/apps/xmlsec1 decrypt  --crypto openssl --crypto-config /tmp/xmlsec-crypto-config --keys-file /private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30/tests/nist-aesgcm/keys-aes256-gcm.xml --output /tmp/testEnc.sh.20201018_194954-33598.tmp.2 /tmp/testEnc.sh.20201018_194954-33598.tmp
I/O warning : failed to load external entity "/tmp/testEnc.sh.20201018_194954-33598.tmp"
func=xmlSecParseFile:file=parser.c:line=373:obj=unknown:subj=xmlCreateFileParserCtxt:error=5:libxml2 library function failed:filename=/tmp/testEnc.sh.20201018_194954-33598.tmp; xml error: 1549: failed to load external entity "/tmp/testEnc.sh.20201018_194954-33598.tmp"

Error: failed to parse xml file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to load template "/tmp/testEnc.sh.20201018_194954-33598.tmp"
Error: failed to decrypt file "/tmp/testEnc.sh.20201018_194954-33598.tmp"
make[1]: *** [Makefile:1184: check-crypto-openssl] Error 188
make[1]: Leaving directory '/private/var/folders/xm/n96l21b93xx1bm16cjr16gq40000gn/T/nix-build-xmlsec-1.2.30.drv-0/xmlsec1-1.2.30'
make: *** [Makefile:1179: check-all] Error 1
builder for '/nix/store/vpi94fq88k2a5sws953n3c7s895k8gad-xmlsec-1.2.30.drv' failed with exit code 2
cannot build derivation '/nix/store/c848559pvhkvgkagyap3wz198b6620w6-oath-toolkit-2.6.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/bc995y2fw3isn7zbrz91qlwa5zyijfzb-pass-extensions-env.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/a2l5x4fq0i4ilj7qqblav32x5lj15fs4-home-manager-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/i5hwkrpqb3bphiq9mjmh7z7g98ib1jd5-pass-extensions-env-fish-completions.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/p3a8pdlgaybgjvlmq11fvk00dxvpzbrq-home-manager-generation.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/p62jpdyn640yg83f7aspvpi159iiw3j5-activation-toonn.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wb8vaq83zhv1x88jdbknd0861hjn7f6h-darwin-system-21.03pre246624.cfed29bfcb2+darwin4.0000000.drv': 1 dependencies couldn't be built
error: build of '/nix/store/wb8vaq83zhv1x88jdbknd0861hjn7f6h-darwin-system-21.03pre246624.cfed29bfcb2+darwin4.0000000.drv' failed
```
xmlsec is not a dependency AFAIK. Try building with the Nixpkgs from a few days ago.
Oh, you're right. Build succeeded, took the correct branch and Kitty.app seems to be working.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,7 @@
 import subprocess
 import sys
 import sysconfig
+import tempfile
 import time
 from contextlib import suppress
 from functools import partial
@@ -211,25 +212,27 @@ def get_sanitize_args(cc: str, ccver: Tuple[int, int]) -> List[str]:
     return sanitize_args
 
 
-def test_compile(cc: str, *cflags: str, src: Optional[str] = None) -> bool:
+def test_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: Optional[str] = None) -> bool:
+    lang = lang or 'c'
     src = src or 'int main(void) { return 0; }'
-    p = subprocess.Popen(
-        [cc] + list(cflags) + ['-x', 'c', '-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', tdir + '/result', '-'],
+            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) -> str:
+def first_successful_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: Optional[str] = None) -> str:
     for x in cflags:
-        if test_compile(cc, *shlex.split(x), src=src):
+        if test_compile(cc, *shlex.split(x), src=src, lang=lang):
             return x
     return ''
 
@@ -340,7 +343,10 @@ def kitty_env() -> Env:
         platform_libs = [
             '-framework', 'CoreText', '-framework', 'CoreGraphics',
         ]
-        user_notifications_framework = first_successful_compile(ans.cc, '-framework UserNotifications')
+        test_program_src = '''#include <UserNotifications/UserNotifications.h>
+        int main(void) { return 0; }\n'''
+        user_notifications_framework = first_successful_compile(ans.cc, ' -framework UserNotifications',
+                                                                src=test_program_src, lang='objective-c')
         if user_notifications_framework:
             platform_libs.extend(shlex.split(user_notifications_framework))
         else:


Test patch: