Initial port of haven-cli

+146
+63
pkgs/applications/blockchains/haven-cli/default.nix
··· 1 + { lib, stdenv, fetchFromGitHub, fetchpatch 2 + , cmake, pkg-config 3 + , boost, miniupnpc, openssl, unbound 4 + , zeromq, pcsclite, readline, libsodium, hidapi 5 + , randomx, rapidjson 6 + , easyloggingpp 7 + , CoreData, IOKit, PCSC 8 + , trezorSupport ? true, libusb1, protobuf, python3 9 + }: 10 + 11 + stdenv.mkDerivation rec { 12 + pname = "haven-cli"; 13 + version = "2.2.3"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "haven-protocol-org"; 17 + repo = "haven-main"; 18 + rev = "v${version}"; 19 + sha256 = "sha256-nBVLNT0jWIewr6MPDGwDqXoVtyFLyls1IEQraVoWDQ4="; 20 + fetchSubmodules = true; 21 + }; 22 + 23 + patches = [ 24 + ./use-system-libraries.patch 25 + ]; 26 + 27 + postPatch = '' 28 + # remove vendored libraries 29 + rm -r external/{miniupnp,randomx,rapidjson,unbound} 30 + # export patched source for haven-gui 31 + cp -r . $source 32 + ''; 33 + 34 + nativeBuildInputs = [ cmake pkg-config ]; 35 + 36 + buildInputs = [ 37 + boost miniupnpc openssl unbound 38 + zeromq pcsclite readline 39 + libsodium hidapi randomx rapidjson 40 + protobuf 41 + readline easyloggingpp 42 + ] 43 + ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ]; 44 + 45 + cmakeFlags = [ 46 + "-DCMAKE_BUILD_TYPE=Release" 47 + "-DUSE_DEVICE_TREZOR=ON" 48 + "-DBUILD_GUI_DEPS=ON" 49 + "-DReadline_ROOT_DIR=${readline.dev}" 50 + "-DReadline_INCLUDE_DIR=${readline.dev}/include/readline" 51 + "-DRandomX_ROOT_DIR=${randomx}" 52 + ] ++ lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF"; 53 + 54 + outputs = [ "out" "source" ]; 55 + 56 + meta = with lib; { 57 + description = "Haven Protocol is the world's only network of private stable asset"; 58 + homepage = "https://havenprotocol.org/"; 59 + license = licenses.bsd3; 60 + platforms = platforms.all; 61 + maintainers = with maintainers; [ kim0 ]; 62 + }; 63 + }
+79
pkgs/applications/blockchains/haven-cli/use-system-libraries.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index fb71d2d..3a710a4 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -200,11 +200,11 @@ if(NOT MANUAL_SUBMODULES) 6 + endfunction () 7 + 8 + message(STATUS "Checking submodules") 9 + - check_submodule(external/miniupnp) 10 + - check_submodule(external/unbound) 11 + - check_submodule(external/rapidjson) 12 + + # check_submodule(external/miniupnp) 13 + + # check_submodule(external/unbound) 14 + + # check_submodule(external/rapidjson) 15 + check_submodule(external/trezor-common) 16 + - check_submodule(external/randomx) 17 + + # check_submodule(external/randomx) 18 + endif() 19 + endif() 20 + 21 + @@ -300,7 +300,8 @@ endif() 22 + # elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") 23 + # set(BSDI TRUE) 24 + 25 + -include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external) 26 + +include_directories(external/easylogging++ src contrib/epee/include external) 27 + +#include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external) 28 + 29 + if(APPLE) 30 + include_directories(SYSTEM /usr/include/malloc) 31 + diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt 32 + index 71b165f..10189ce 100644 33 + --- a/external/CMakeLists.txt 34 + +++ b/external/CMakeLists.txt 35 + @@ -37,19 +37,9 @@ 36 + 37 + find_package(Miniupnpc REQUIRED) 38 + 39 + -message(STATUS "Using in-tree miniupnpc") 40 + -add_subdirectory(miniupnp/miniupnpc) 41 + -set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external") 42 + -if(MSVC) 43 + - set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267") 44 + -elseif(NOT MSVC) 45 + - set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value") 46 + -endif() 47 + -if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") 48 + - set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE") 49 + -endif() 50 + - 51 + -set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) 52 + +set(UPNP_STATIC false PARENT_SCOPE) 53 + +set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE) 54 + +set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE) 55 + 56 + find_package(Unbound) 57 + 58 + @@ -80,4 +70,3 @@ endif() 59 + 60 + add_subdirectory(db_drivers) 61 + add_subdirectory(easylogging++) 62 + -add_subdirectory(randomx EXCLUDE_FROM_ALL) 63 + diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl 64 + index c626e22..be570ed 100644 65 + --- a/src/p2p/net_node.inl 66 + +++ b/src/p2p/net_node.inl 67 + @@ -60,9 +60,9 @@ 68 + #include "cryptonote_core/cryptonote_core.h" 69 + #include "net/parse.h" 70 + 71 + -#include <miniupnp/miniupnpc/miniupnpc.h> 72 + -#include <miniupnp/miniupnpc/upnpcommands.h> 73 + -#include <miniupnp/miniupnpc/upnperrors.h> 74 + +#include <miniupnpc/miniupnpc.h> 75 + +#include <miniupnpc/upnpcommands.h> 76 + +#include <miniupnpc/upnperrors.h> 77 + 78 + #undef MONERO_DEFAULT_LOG_CATEGORY 79 + #define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
+4
pkgs/top-level/all-packages.nix
··· 31047 31047 inherit (darwin.apple_sdk.frameworks) CoreData IOKit PCSC; 31048 31048 }; 31049 31049 31050 + haven-cli = callPackage ../applications/blockchains/haven-cli { 31051 + inherit (darwin.apple_sdk.frameworks) CoreData IOKit PCSC; 31052 + }; 31053 + 31050 31054 monero-gui = libsForQt5.callPackage ../applications/blockchains/monero-gui { 31051 31055 boost = boost17x; 31052 31056 };