commit b0bad300fc7e3131977c0343f755e7211101f4fe
parent a81c44e846925e98f75853c71377506e45da8e4b
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Tue, 21 Nov 2023 00:00:14 +0400
Add diagon
Diffstat:
3 files changed, 122 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -340,6 +340,7 @@ lib.makeScope newScope (
complgen = callPackage ./misc/complgen { };
csv2html = callPackage ./misc/csv2html { };
csvtools = callPackage ./misc/csvtools { };
+ diagon = callPackage ./misc/diagon { };
dns-filter = callPackage ./misc/dns-filter { };
docker-reg-tool = callPackage ./misc/docker-reg-tool { };
docx2csv = callPackage ./misc/docx2csv { };
diff --git a/pkgs/misc/diagon/default.nix b/pkgs/misc/diagon/default.nix
@@ -0,0 +1,67 @@
+{ lib, stdenv, fetchFromGitHub, fetchurl, substituteAll, cmake, boost, jre }:
+
+let
+ json_src = fetchFromGitHub {
+ owner = "ArthurSonzogni";
+ repo = "nlohmann_json_cmake_fetchcontent";
+ rev = "v3.9.1";
+ hash = "sha256-5A18zFqbgDc99pqQUPcpwHi89WXb8YVR9VEwO18jH2I=";
+ };
+ antlr_src = fetchFromGitHub {
+ owner = "ArthurSonzogni";
+ repo = "antlr4";
+ rev = "remove-pthread";
+ hash = "sha256-ohhj59+rBZBUvL9exURx4BHgeM+zUUvvcHkdh8hJLw0=";
+ };
+ antlr_jar = fetchurl {
+ url = "http://www.antlr.org/download/antlr-4.11.1-complete.jar";
+ hash = "sha256-YpdeGStK8mIrcrXwExVT7jy86X923CpBYy3MVeJUc+E=";
+ };
+ kgt_src = fetchFromGitHub {
+ owner = "ArthurSonzogni";
+ repo = "kgt";
+ rev = "56c3f46cf286051096d9295118c048219fe0d776";
+ hash = "sha256-xH0htDZd2UihLn7PHKLjEYETzcBSeJFOMNredTqlCW8=";
+ };
+in
+stdenv.mkDerivation rec {
+ pname = "diagon";
+ version = "1.1.158";
+
+ src = fetchFromGitHub {
+ owner = "ArthurSonzogni";
+ repo = "Diagon";
+ rev = "v${version}";
+ hash = "sha256-Qxk3+1T0IPmvB5v3jaqvBnESpss6L8bvoW+R1l5RXdQ=";
+ };
+
+ patches = [
+ # Prevent CMake from trying to fetch libraries from GitHub
+ (substituteAll {
+ src = ./deps.patch;
+ inherit antlr_src antlr_jar json_src kgt_src;
+ })
+ ];
+
+ nativeBuildInputs = [ cmake jre ];
+
+ buildInputs = [ boost ];
+
+ cmakeFlags = [
+ (lib.cmakeBool "DIAGON_BUILD_TESTS" true)
+ ];
+
+ doCheck = true;
+
+ postCheck = ''
+ ./input_output_test
+ '';
+
+ meta = with lib; {
+ description = "Interactive ASCII art diagram generators";
+ inherit (src.meta) homepage;
+ license = licenses.mit;
+ maintainers = [ maintainers.sikmir ];
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/misc/diagon/deps.patch b/pkgs/misc/diagon/deps.patch
@@ -0,0 +1,54 @@
+diff --git i/CMakeLists.txt w/CMakeLists.txt
+index efe6486..d6f5ff8 100644
+--- i/CMakeLists.txt
++++ w/CMakeLists.txt
+@@ -20,9 +20,7 @@ set(FETCHCONTENT_QUIET FALSE)
+ #-------------------------------------------------------------------------------
+
+ FetchContent_Declare(json
+- GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
+- GIT_TAG v3.9.1
+- GIT_PROGRESS TRUE
++ SOURCE_DIR @json_src@
+ )
+
+ FetchContent_GetProperties(json)
+@@ -34,10 +32,7 @@ endif()
+ #-------------------------------------------------------------------------------
+
+ FetchContent_Declare(antlr
+- GIT_REPOSITORY https://github.com/antlr/antlr4
+- GIT_TAG 1cb4669f84cea5b59661fd44b0f80509fdacd3f9
+- GIT_SHALLOW FALSE
+- GIT_PROGRESS TRUE
++ SOURCE_DIR @antlr_src@
+ )
+
+ FetchContent_GetProperties(antlr)
+diff --git i/src/translator/grammar/CMakeLists.txt w/src/translator/grammar/CMakeLists.txt
+index 1af0285..5ab5a80 100644
+--- i/src/translator/grammar/CMakeLists.txt
++++ w/src/translator/grammar/CMakeLists.txt
+@@ -8,8 +8,7 @@ else()
+ include(FetchContent)
+ set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
+ FetchContent_Declare(kgt
+- GIT_REPOSITORY https://github.com/ArthurSonzogni/kgt
+- GIT_TAG 56c3f46cf286051096d9295118c048219fe0d776
++ SOURCE_DIR @kgt_src@
+ )
+ FetchContent_GetProperties(kgt)
+ FetchContent_Populate(kgt)
+diff --git i/tools/CMakeLists.txt w/tools/CMakeLists.txt
+index 4724c28..f36960c 100644
+--- i/tools/CMakeLists.txt
++++ w/tools/CMakeLists.txt
+@@ -33,7 +33,7 @@ function(ANTLR source)
+ COMMAND
+ java
+ ARGS
+- -jar ${CMAKE_BINARY_DIR}/antlr.jar
++ -jar @antlr_jar@
+ -Dlanguage=Cpp
+ -no-listener
+ -no-visitor