kitty/shell.nix
Luflosi 7ea4c1e47f
shell.nix: add dependency needed on Apple silicon
shell.nix is missing a depencency on the UserNotifications framework on macOS with Apple silicon. Unfortunately we can't just unconditionally include this dependency because Nixpkgs uses a different macOS SDK version for macOS on an Intel processor compared to macOS on Apple silicon. The older SDK version 10.12 on Intel does not have the UserNotifications framework, which would lead to an "attribute missing" error when trying to execute `nix-shell`. The condition can be dropped when the macOS SDK version for Intel processors is finally updated. See https://github.com/NixOS/nixpkgs/issues/101229 for progress on that.
See https://github.com/NixOS/nixpkgs/pull/137512 for more context.
Closes https://github.com/kovidgoyal/kitty/issues/4352.
2021-12-28 15:35:16 +01:00

65 lines
1.7 KiB
Nix

{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
inherit (lib) optional optionals;
inherit (xorg) libX11 libXrandr libXinerama libXcursor libXi libXext;
inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation IOKit Kernel OpenGL;
harfbuzzWithCoreText = harfbuzz.override { withCoreText = stdenv.isDarwin; };
in
with python3Packages;
mkShell rec {
buildInputs = [
harfbuzzWithCoreText
ncurses
lcms2
librsync
] ++ optionals stdenv.isDarwin [
Cocoa
CoreGraphics
Foundation
IOKit
Kernel
OpenGL
libpng
python3
zlib
] ++ lib.optionals (stdenv.isDarwin && (builtins.hasAttr "UserNotifications" darwin.apple_sdk.frameworks)) [
darwin.apple_sdk.frameworks.UserNotifications
] ++ optionals stdenv.isLinux [
fontconfig libunistring libcanberra libX11
libXrandr libXinerama libXcursor libxkbcommon libXi libXext
wayland-protocols wayland dbus
] ++ checkInputs;
nativeBuildInputs = [
ncurses
pkg-config
sphinx
furo
sphinx-copybutton
sphinxext-opengraph
sphinx-inline-tabs
] ++ optionals stdenv.isDarwin [
imagemagick
libicns # For the png2icns tool.
];
propagatedBuildInputs = optional stdenv.isLinux libGL;
checkInputs = [
pillow
];
# Causes build failure due to warning when using Clang
hardeningDisable = [ "strictoverflow" ];
shellHook = if stdenv.isDarwin then ''
export KITTY_NO_LTO=
'' else ''
export KITTY_EGL_LIBRARY='${lib.getLib libGL}/lib/libEGL.so.1'
export KITTY_STARTUP_NOTIFICATION_LIBRARY='${libstartup_notification}/lib/libstartup-notification-1.so'
export KITTY_CANBERRA_LIBRARY='${libcanberra}/lib/libcanberra.so'
'';
}