commit 7bdd4abdeadc3b49c0cdfeaa902a7b1bdd55f9a1
parent df89c590e2140e3001a4b23e3edc9fcfd3852c17
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Sun, 18 Jun 2023 01:56:33 +0400
Add json-tui
Diffstat:
3 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -342,6 +342,7 @@ lib.makeScope newScope (
how-to-use-pvs-studio-free = callPackage ./misc/pvs-studio/how-to-use-pvs-studio-free.nix { };
huami-token = callPackage ./misc/huami-token { };
ish = callPackage ./misc/ish { };
+ json-tui = callPackage ./misc/json-tui { };
lazyscraper = callPackage ./misc/lazyscraper { };
libmdbx = callPackage ./misc/libmdbx { };
libnbcompat = callPackage ./misc/libnbcompat { };
diff --git a/pkgs/misc/json-tui/default.nix b/pkgs/misc/json-tui/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub, cmake, ftxui, nlohmann_json, libargs }:
+
+stdenv.mkDerivation rec {
+ pname = "json-tui";
+ version = "1.3.0";
+
+ src = fetchFromGitHub {
+ owner = "ArthurSonzogni";
+ repo = "json-tui";
+ rev = "v${version}";
+ hash = "sha256-Rgan+Pki4kOFf4BiNmJV4mf/rgyIGgUVP1BcFCKG25w=";
+ };
+
+ patches = [ ./no-deps.patch ];
+
+ nativeBuildInputs = [ cmake ];
+
+ buildInputs = [ ftxui nlohmann_json libargs ];
+
+ meta = with lib; {
+ description = "A JSON terminal UI made in C++";
+ inherit (src.meta) homepage;
+ license = licenses.mit;
+ maintainers = [ maintainers.sikmir ];
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/misc/json-tui/no-deps.patch b/pkgs/misc/json-tui/no-deps.patch
@@ -0,0 +1,79 @@
+diff --git i/CMakeLists.txt w/CMakeLists.txt
+index 835401e..1a81954 100644
+--- i/CMakeLists.txt
++++ w/CMakeLists.txt
+@@ -1,46 +1,15 @@
+ cmake_minimum_required (VERSION 3.11)
+
+-# Dependencies -----------------------------------------------------------------
+-
+-include(FetchContent)
+-set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
+-set(FETCHCONTENT_QUIET FALSE)
+-
+-FetchContent_Declare(ftxui
+- GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
+- GIT_TAG 382205c05732a420a300e990218653b1c3ac0fc9
+- GIT_PROGRESS TRUE
+- GIT_SHALLOW FALSE
+-)
+-
+-FetchContent_Declare(json
+- URL https://github.com/nlohmann/json/releases/download/v3.10.5/json-3.10.5.tar.xz
+-)
+-
+-FetchContent_Declare(args
+- GIT_REPOSITORY https://github.com/Taywee/args
+- GIT_TAG a48e1f880813b367d2354963a58dedbf2b708584
+- GIT_PROGRESS TRUE
+- GIT_SHALLOW FALSE
++project(json-tui
++ LANGUAGES CXX
++ VERSION 1.3.0
+ )
+
+-FetchContent_GetProperties(ftxui)
+-if(NOT ftxui_POPULATED)
+- FetchContent_Populate(ftxui)
+- add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
+-endif()
+-
+-FetchContent_GetProperties(json)
+-if(NOT json_POPULATED)
+- FetchContent_Populate(json)
+- add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
+-endif()
++# Dependencies -----------------------------------------------------------------
+
+-FetchContent_GetProperties(args)
+-if(NOT args_POPULATED)
+- FetchContent_Populate(args)
+- add_subdirectory(${args_SOURCE_DIR} ${args_BINARY_DIR} EXCLUDE_FROM_ALL)
+-endif()
++find_package(ftxui REQUIRED)
++find_package(nlohmann_json REQUIRED)
++find_package(args REQUIRED)
+
+ # Build ------------------------------------------------------------------------
+
+@@ -49,11 +18,6 @@ configure_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/src/version.hpp
+ )
+
+-project(json-tui
+- LANGUAGES CXX
+- VERSION 1.3.0
+-)
+-
+ add_executable(json-tui
+ src/main.cpp
+ src/mytoggle.cpp
+@@ -70,7 +34,7 @@ target_link_libraries(json-tui
+ PRIVATE ftxui::screen
+ PRIVATE ftxui::dom
+ PRIVATE ftxui::component
+- PRIVATE args
++# PRIVATE args
+ PRIVATE nlohmann_json::nlohmann_json
+ )
+