fix: Correct Nix shell for building correctly

This commit is contained in:
Gabriel Nützi
2023-11-30 22:09:15 +01:00
parent 165f1ccfd1
commit 1883208cf6

View File

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