1{ pkgs ? import <nixpkgs> { } }: 2with pkgs; 3 4let 5 inherit (lib) optional optionals; 6 inherit (xorg) libX11 libXrandr libXinerama libXcursor libXi libXext; 7 inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation IOKit Kernel OpenGL; 8 harfbuzzWithCoreText = harfbuzz.override { withCoreText = stdenv.isDarwin; }; 9in 10mkShell rec { 11 buildInputs = [ 12 harfbuzzWithCoreText 13 ncurses 14 lcms2 15 ] ++ optionals stdenv.isDarwin [ 16 Cocoa 17 CoreGraphics 18 Foundation 19 IOKit 20 Kernel 21 OpenGL 22 libpng 23 python3 24 zlib 25 ] ++ optionals stdenv.isLinux [ 26 fontconfig libunistring libcanberra libX11 27 libXrandr libXinerama libXcursor libxkbcommon libXi libXext 28 wayland-protocols wayland dbus 29 ] ++ checkInputs; 30 31 nativeBuildInputs = [ 32 pkgconfig python3Packages.sphinx ncurses 33 ] ++ optionals stdenv.isDarwin [ 34 imagemagick 35 libicns # For the png2icns tool. 36 installShellFiles 37 ]; 38 39 propagatedBuildInputs = optional stdenv.isLinux libGL; 40 41 checkInputs = [ 42 python3Packages.pillow 43 ]; 44 45 # Causes build failure due to warning when using Clang 46 hardeningDisable = [ "strictoverflow" ]; 47 48 shellHook = if stdenv.isDarwin then '' 49 export KITTY_NO_LTO= 50 '' else '' 51 export KITTY_EGL_LIBRARY='${lib.getLib libGL}/lib/libEGL.so.1' 52 export KITTY_STARTUP_NOTIFICATION_LIBRARY='${libstartup_notification}/lib/libstartup-notification-1.so' 53 export KITTY_CANBERRA_LIBRARY='${libcanberra}/lib/libcanberra.so' 54 ''; 55} 56