571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
62 lines
1.8 KiB
Nix
62 lines
1.8 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, imgui
|
|
, ninja
|
|
, withEmscripten ? false, emscripten
|
|
, withCurl ? (!withEmscripten), curl
|
|
, withNcurses ? (!withEmscripten), ncurses
|
|
, static ? withEmscripten
|
|
, darwin
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "imtui";
|
|
version = "1.0.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ggerganov";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-eHQPDEfxKGLdiOi0lUUgqJcmme1XJLSPAafT223YK+U=";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
|
|
|
buildInputs = lib.optional withEmscripten emscripten
|
|
++ lib.optional withCurl curl
|
|
++ lib.optional withNcurses ncurses
|
|
++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Cocoa;
|
|
|
|
postPatch = ''
|
|
cp -r ${imgui.src}/* third-party/imgui/imgui
|
|
chmod -R u+w third-party/imgui
|
|
'' + lib.optionalString (lib.versionAtLeast imgui.version "1.90.1") ''
|
|
substituteInPlace src/imtui-impl-{emscripten,ncurses}.cpp \
|
|
--replace "ImGuiKey_KeyPadEnter" "ImGuiKey_KeypadEnter"
|
|
'';
|
|
|
|
cmakeFlags = [
|
|
"-DEMSCRIPTEN:BOOL=${if withEmscripten then "ON" else "OFF"}"
|
|
"-DIMTUI_SUPPORT_CURL:BOOL=${if withCurl then "ON" else "OFF"}"
|
|
"-DIMTUI_SUPPORT_NCURSES:BOOL=${if withNcurses then "ON" else "OFF"}"
|
|
"-DBUILD_SHARED_LIBS:BOOL=${if (!static) then "ON" else "OFF"}"
|
|
"-DIMTUI_BUILD_EXAMPLES:BOOL=OFF"
|
|
"-DIMTUI_INSTALL_IMGUI_HEADERS:BOOL=OFF"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Immediate mode text-based user interface library";
|
|
longDescription = ''
|
|
ImTui is an immediate mode text-based user interface library. Supports 256
|
|
ANSI colors and mouse/keyboard input.
|
|
'';
|
|
homepage = "https://imtui.ggerganov.com";
|
|
changelog = "https://github.com/ggerganov/imtui/blob/${src.rev}/CHANGELOG.md";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ azahi ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|