shell.nix 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {pkgs ? import <nixpkgs> {}}:
  2. with pkgs; let
  3. inherit (lib) optional optionals;
  4. inherit (xorg) libX11 libXrandr libXinerama libXcursor libXi libXext;
  5. inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation IOKit Kernel OpenGL UniformTypeIdentifiers;
  6. harfbuzzWithCoreText = harfbuzz.override {withCoreText = stdenv.isDarwin;};
  7. in
  8. with python3Packages;
  9. mkShell rec {
  10. buildInputs =
  11. [
  12. harfbuzzWithCoreText
  13. ncurses
  14. lcms2
  15. xxhash
  16. ]
  17. ++ optionals stdenv.isDarwin [
  18. Cocoa
  19. CoreGraphics
  20. Foundation
  21. IOKit
  22. Kernel
  23. OpenGL
  24. UniformTypeIdentifiers
  25. libpng
  26. python3
  27. zlib
  28. ]
  29. ++ lib.optionals (stdenv.isDarwin && (builtins.hasAttr "UserNotifications" darwin.apple_sdk.frameworks)) [
  30. darwin.apple_sdk.frameworks.UserNotifications
  31. ]
  32. ++ optionals stdenv.isLinux [
  33. fontconfig
  34. libunistring
  35. libcanberra
  36. libX11
  37. libXrandr
  38. libXinerama
  39. libXcursor
  40. libxkbcommon
  41. libXi
  42. libXext
  43. wayland-protocols
  44. wayland
  45. openssl
  46. xxHash
  47. dbus
  48. simde
  49. ]
  50. ++ checkInputs;
  51. nativeBuildInputs =
  52. [
  53. ncurses
  54. pkg-config
  55. sphinx
  56. furo
  57. sphinx-copybutton
  58. sphinxext-opengraph
  59. sphinx-inline-tabs
  60. ]
  61. ++ optionals stdenv.isDarwin [
  62. imagemagick
  63. libicns # For the png2icns tool.
  64. ];
  65. propagatedBuildInputs = optional stdenv.isLinux libGL;
  66. checkInputs = [
  67. pillow
  68. ];
  69. # Causes build failure due to warning when using Clang
  70. hardeningDisable = ["strictoverflow"];
  71. shellHook =
  72. if stdenv.isDarwin
  73. then ''
  74. export KITTY_NO_LTO=
  75. ''
  76. else ''
  77. export KITTY_EGL_LIBRARY='${lib.getLib libGL}/lib/libEGL.so.1'
  78. export KITTY_STARTUP_NOTIFICATION_LIBRARY='${libstartup_notification}/lib/libstartup-notification-1.so'
  79. export KITTY_CANBERRA_LIBRARY='${libcanberra}/lib/libcanberra.so'
  80. '';
  81. }