at 24.11-pre 64 lines 1.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, imgui 6, ninja 7, withEmscripten ? false, emscripten 8, withCurl ? (!withEmscripten), curl 9, withNcurses ? (!withEmscripten), ncurses 10, static ? withEmscripten 11, darwin 12}: 13 14stdenv.mkDerivation rec { 15 pname = "imtui"; 16 version = "1.0.5"; 17 18 src = fetchFromGitHub { 19 owner = "ggerganov"; 20 repo = pname; 21 rev = "v${version}"; 22 hash = "sha256-eHQPDEfxKGLdiOi0lUUgqJcmme1XJLSPAafT223YK+U="; 23 }; 24 25 nativeBuildInputs = [ cmake ninja ]; 26 27 buildInputs = lib.optional withEmscripten emscripten 28 ++ lib.optional withCurl curl 29 ++ lib.optional withNcurses ncurses 30 ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Cocoa; 31 32 postPatch = '' 33 cp -r ${imgui}/include/imgui third-party/imgui 34 '' + lib.optionalString (lib.versionAtLeast imgui.version "1.90.1") '' 35 substituteInPlace src/imtui-impl-{emscripten,ncurses}.cpp \ 36 --replace "ImGuiKey_KeyPadEnter" "ImGuiKey_KeypadEnter" 37 ''; 38 39 cmakeFlags = [ 40 "-DEMSCRIPTEN:BOOL=${if withEmscripten then "ON" else "OFF"}" 41 "-DIMTUI_SUPPORT_CURL:BOOL=${if withCurl then "ON" else "OFF"}" 42 "-DIMTUI_SUPPORT_NCURSES:BOOL=${if withNcurses then "ON" else "OFF"}" 43 "-DBUILD_SHARED_LIBS:BOOL=${if (!static) then "ON" else "OFF"}" 44 "-DIMTUI_BUILD_EXAMPLES:BOOL=OFF" 45 "-DIMTUI_INSTALL_IMGUI_HEADERS:BOOL=OFF" 46 ]; 47 48 postInstall = '' 49 rm -rf $out/include/imgui 50 ''; 51 52 meta = with lib; { 53 description = "Immediate mode text-based user interface library"; 54 longDescription = '' 55 ImTui is an immediate mode text-based user interface library. Supports 256 56 ANSI colors and mouse/keyboard input. 57 ''; 58 homepage = "https://imtui.ggerganov.com"; 59 changelog = "https://github.com/ggerganov/imtui/blob/${src.rev}/CHANGELOG.md"; 60 license = licenses.mit; 61 maintainers = with maintainers; [ azahi ]; 62 platforms = platforms.unix; 63 }; 64}