shell.nix 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. ]
  49. ++ checkInputs;
  50. nativeBuildInputs =
  51. [
  52. ncurses
  53. pkg-config
  54. sphinx
  55. furo
  56. sphinx-copybutton
  57. sphinxext-opengraph
  58. sphinx-inline-tabs
  59. ]
  60. ++ optionals stdenv.isDarwin [
  61. imagemagick
  62. libicns # For the png2icns tool.
  63. ];
  64. propagatedBuildInputs = optional stdenv.isLinux libGL;
  65. checkInputs = [
  66. pillow
  67. ];
  68. # Causes build failure due to warning when using Clang
  69. hardeningDisable = ["strictoverflow"];
  70. shellHook =
  71. if stdenv.isDarwin
  72. then ''
  73. export KITTY_NO_LTO=
  74. ''
  75. else ''
  76. export KITTY_EGL_LIBRARY='${lib.getLib libGL}/lib/libEGL.so.1'
  77. export KITTY_STARTUP_NOTIFICATION_LIBRARY='${libstartup_notification}/lib/libstartup-notification-1.so'
  78. export KITTY_CANBERRA_LIBRARY='${libcanberra}/lib/libcanberra.so'
  79. '';
  80. }