summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/js/json-tui/package.nix
blob: 6a1163d0ddf400b0f452d291c0524c042e9ac1e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  lib,
  stdenv,
  fetchFromGitHub,

  cmake,
  ftxui,
  libargs,
  nlohmann_json,
  gtest,
  gbenchmark,

  versionCheckHook,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "json-tui";
  version = "1.4.2";

  src = fetchFromGitHub {
    owner = "ArthurSonzogni";
    repo = "json-tui";
    tag = "v${finalAttrs.version}";
    hash = "sha256-PXiTlTwF/qL/Nq1PSf8PHgKa0MD6QrA0tSWiFfm93Gk=";
  };

  strictDeps = true;

  buildInputs = [
    ftxui
    libargs
    nlohmann_json
  ];

  nativeBuildInputs = [ cmake ];

  checkInputs = [ gbenchmark ];

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  env.NIX_CFLAGS_COMPILE = "-fexceptions";

  cmakeFlags = [
    "-Wno-dev" # suppress cmake warning about deprecated usage
    (lib.cmakeBool "JSON_TUI_BUILD_TESTS" finalAttrs.finalPackage.doCheck)
    (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_GOOGLETEST" "${gtest.src}")
  ];

  doInstallCheck = true;
  versionCheckProgramArg = "--version";
  nativeInstallCheckInputs = [ versionCheckHook ];

  meta = {
    homepage = "https://github.com/ArthurSonzogni/json-tui";
    changelog = "https://github.com/ArthurSonzogni/json-tui/blob/v${finalAttrs.version}/CHANGELOG.md";
    description = "JSON terminal UI made in C++";
    license = lib.licenses.mit;
    mainProgram = "json-tui";
    maintainers = with lib.maintainers; [ phanirithvij ];
    platforms = lib.platforms.all;
  };
})