diff --git a/pkgs/applications/blockchains/monero-cli/default.nix b/pkgs/applications/blockchains/monero-cli/default.nix index 50d5d1b109a3..98b9deb79222 100644 --- a/pkgs/applications/blockchains/monero-cli/default.nix +++ b/pkgs/applications/blockchains/monero-cli/default.nix @@ -1,9 +1,30 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch2, cmake, ninja, pkg-config -, boost, miniupnpc, openssl, unbound -, zeromq, pcsclite, readline, libsodium, hidapi -, randomx, rapidjson -, CoreData, IOKit, PCSC -, trezorSupport ? true, libusb1, protobuf, python3 +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + ninja, + pkg-config, + boost, + libsodium, + miniupnpc, + openssl, + python3, + randomx, + rapidjson, + readline, + unbound, + zeromq, + + # darwin + CoreData, + IOKit, + + trezorSupport ? true, + hidapi, + libusb1, + protobuf_21, + udev, }: let @@ -25,40 +46,16 @@ in stdenv.mkDerivation rec { pname = "monero-cli"; - version = "0.18.3.3"; + version = "0.18.3.4"; src = fetchFromGitHub { owner = "monero-project"; repo = "monero"; rev = "v${version}"; - hash = "sha256-1LkKIrud317BEE+713t5wiJV6FcDlJdj4ypXPR0bKTs="; + hash = "sha256-nDiFJjhsISYM8kTgJUaPYL44iyccnz5+Pd5beBh+lsM="; }; - patches = [ - # cmake: remove unused/extera cmake/FindMiniupnpc.cmake and only rely on external/miniupnpc - # https://github.com/monero-project/monero/pull/9366 - (fetchpatch2 { - url = "https://github.com/monero-project/monero/commit/5074a543a49f7e23fb39b6462fd4c4c9741c3693.patch?full_index=1"; - hash = "sha256-dS2hhEU6m2of0ULlsf+/tZMHUmq3vGGXJPGHvtnpQnY="; - }) - - # cmake: add different parameters to add_monero_library. - # https://github.com/monero-project/monero/pull/9367 - (fetchpatch2 { - url = "https://github.com/monero-project/monero/commit/b91ead90254ac6d6daf908f689c38e372a44c615.patch?full_index=1"; - hash = "sha256-DL2YqkvEONbeEDqLOAo2eSF5JF5gOzKcLKeNlUXBY1w="; - }) - - # external: update miniupnpc to 2.2.8 - # https://github.com/monero-project/monero/pull/9367 - (fetchpatch2 { - url = "https://github.com/monero-project/monero/commit/d81da086ec5088a04b3f7b34831e72910300e2f7.patch?full_index=1"; - hash = "sha256-ZJGiDMk5DMmEXwzoUYPC+DIoebluFh54kMQtQU78ckI="; - excludes = [ "external/miniupnp" ]; - }) - - ./use-system-libraries.patch - ]; + patches = [ ./use-system-libraries.patch ]; postPatch = '' # manually install submodules @@ -69,31 +66,58 @@ stdenv.mkDerivation rec { cp -r . $source ''; - nativeBuildInputs = [ cmake ninja pkg-config ]; + nativeBuildInputs = [ + cmake + pkg-config + ]; - buildInputs = [ - boost miniupnpc openssl unbound - zeromq pcsclite readline - libsodium hidapi randomx rapidjson - protobuf - ] ++ lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ] - ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ]; + buildInputs = + [ + boost + libsodium + miniupnpc + openssl + randomx + rapidjson + readline + unbound + zeromq + ] + ++ lib.optionals stdenv.isDarwin [ + IOKit + CoreData + ] + ++ lib.optionals trezorSupport [ + python3 + hidapi + libusb1 + protobuf_21 + udev + ]; - cmakeFlags = [ - "-DUSE_DEVICE_TREZOR=ON" - "-DBUILD_GUI_DEPS=ON" - "-DReadline_ROOT_DIR=${readline.dev}" - "-DRandomX_ROOT_DIR=${randomx}" - ] ++ lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF"; + cmakeFlags = + [ + # skip submodules init + "-DMANUAL_SUBMODULES=ON" + # required by monero-gui + "-DBUILD_GUI_DEPS=ON" + "-DReadline_ROOT_DIR=${readline.dev}" + ] + ++ lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF" + ++ lib.optional trezorSupport [ + "-DUSE_DEVICE_TREZOR=ON" + # fix build on recent gcc versions + "-DCMAKE_CXX_FLAGS=-fpermissive" + ]; outputs = [ "out" "source" ]; - meta = with lib; { + meta = { description = "Private, secure, untraceable currency"; - homepage = "https://getmonero.org/"; - license = licenses.bsd3; - platforms = platforms.all; - maintainers = with maintainers; [ rnhmjoj ]; + homepage = "https://getmonero.org/"; + license = lib.licenses.bsd3; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ rnhmjoj ]; mainProgram = "monero-wallet-cli"; }; } diff --git a/pkgs/applications/blockchains/monero-cli/use-system-libraries.patch b/pkgs/applications/blockchains/monero-cli/use-system-libraries.patch index f8629d47553c..adb41fb4ac25 100644 --- a/pkgs/applications/blockchains/monero-cli/use-system-libraries.patch +++ b/pkgs/applications/blockchains/monero-cli/use-system-libraries.patch @@ -1,14 +1,15 @@ diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index f8b834ac17...520e148428 100644 +index 5b7f69a56..cc4b0a346 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt -@@ -39,23 +39,12 @@ - add_compile_options(-D_GNU_SOURCE) - endif() +@@ -35,25 +35,14 @@ + # ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with + # others. +-find_package(Miniupnpc REQUIRED) +- -message(STATUS "Using in-tree miniupnpc") -set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE) --set(UPNPC_BUILD_TESTS FALSE CACHE BOOL "Disable miniupnp internal tests." FORCE) -add_subdirectory(miniupnp/miniupnpc) -set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external") -set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON) @@ -20,19 +21,58 @@ index f8b834ac17...520e148428 100644 -if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") - set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE") -endif() -+include(FindPkgConfig) -+pkg_check_modules(MINIUPNPC REQUIRED IMPORTED_TARGET GLOBAL miniupnpc) -+get_target_property(MINIUPNPC_INCLUDE_DIR PkgConfig::MINIUPNPC INTERFACE_INCLUDE_DIRECTORIES) -+set_target_properties(PkgConfig::MINIUPNPC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MINIUPNPC_INCLUDE_DIR}/miniupnpc") -+set(UPNP_LIBRARIES PkgConfig::MINIUPNPC PARENT_SCOPE) - --set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) - +-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(MINIUPNPC REQUIRED miniupnpc) ++link_libraries(${MINIUPNPC_LIBRARIES}) ++include_directories(${MINIUPNPC_INCLUDE_DIRS}) + ++find_package(RapidJSON) find_package(Unbound) ++find_library(RANDOMX_LIBRARY randomx) if(NOT UNBOUND_INCLUDE_DIR) -@@ -72,4 +61,3 @@ + die("Could not find libunbound") +@@ -69,4 +58,3 @@ endif() add_subdirectory(db_drivers) add_subdirectory(easylogging++) add_subdirectory(qrcodegen) -add_subdirectory(randomx EXCLUDE_FROM_ALL) +diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl +index 71f5393e8..bb48083d0 100644 +--- a/src/p2p/net_node.inl ++++ b/src/p2p/net_node.inl +@@ -60,9 +60,9 @@ + #include "cryptonote_core/cryptonote_core.h" + #include "net/parse.h" + +-#include +-#include +-#include ++#include ++#include ++#include + + #undef MONERO_DEFAULT_LOG_CATEGORY + #define MONERO_DEFAULT_LOG_CATEGORY "net.p2p" +@@ -2989,7 +2989,8 @@ namespace nodetool + UPNPUrls urls; + IGDdatas igdData; + char lanAddress[64]; +- result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress); ++ char wanAddress[64]; ++ result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof wanAddress); + freeUPNPDevlist(deviceList); + if (result > 0) { + if (result == 1) { +@@ -3057,7 +3058,8 @@ namespace nodetool + UPNPUrls urls; + IGDdatas igdData; + char lanAddress[64]; +- result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress); ++ char wanAddress[64]; ++ result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof wanAddress); + freeUPNPDevlist(deviceList); + if (result > 0) { + if (result == 1) { diff --git a/pkgs/applications/blockchains/monero-gui/default.nix b/pkgs/applications/blockchains/monero-gui/default.nix index d72cad5c5367..d4495a4a9b34 100644 --- a/pkgs/applications/blockchains/monero-gui/default.nix +++ b/pkgs/applications/blockchains/monero-gui/default.nix @@ -1,43 +1,86 @@ -{ lib, stdenv, wrapQtAppsHook, makeDesktopItem -, fetchFromGitHub -, cmake, qttools, pkg-config -, qtbase, qtdeclarative, qtgraphicaleffects -, qtmultimedia, qtxmlpatterns -, qtquickcontrols, qtquickcontrols2 -, qtmacextras -, monero-cli, miniupnpc, unbound, readline -, boost, libunwind, libsodium, pcsclite -, randomx, zeromq, libgcrypt, libgpg-error -, hidapi, rapidjson, quirc -, trezorSupport ? true, libusb1, protobuf, python3 +{ + lib, + fetchFromGitHub, + makeDesktopItem, + boost, + cmake, + libgcrypt, + libgpg-error, + libsodium, + miniupnpc, + monero-cli, + pkg-config, + qtbase, + qtdeclarative, + qtgraphicaleffects, + qtmacextras, + qtmultimedia, + qtquickcontrols, + qtquickcontrols2, + qttools, + qtxmlpatterns, + quirc, + randomx, + rapidjson, + stdenv, + unbound, + wrapQtAppsHook, + zeromq, + + trezorSupport ? true, + hidapi, + libusb1, + protobuf_21, + python3, + udev, }: stdenv.mkDerivation rec { pname = "monero-gui"; - version = "0.18.3.3"; + version = "0.18.3.4"; src = fetchFromGitHub { owner = "monero-project"; repo = "monero-gui"; rev = "v${version}"; - hash = "sha256-6qadBm4bPui11OVY1tLFcHsfswXWBFiJvutIsF6EfX8="; + hash = "sha256-wnU24EmZig2W/psy4OhaQVy2WwR0CgljlyYwOg4bzwM="; }; nativeBuildInputs = [ - cmake pkg-config wrapQtAppsHook + cmake + pkg-config + wrapQtAppsHook (lib.getDev qttools) ]; - buildInputs = [ - qtbase qtdeclarative qtgraphicaleffects - qtmultimedia qtquickcontrols qtquickcontrols2 - qtxmlpatterns - monero-cli miniupnpc unbound readline - randomx libgcrypt libgpg-error - boost libunwind libsodium pcsclite - zeromq hidapi rapidjson quirc - ] ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ] - ++ lib.optionals stdenv.isDarwin [ qtmacextras ]; + buildInputs = + [ + boost + libgcrypt + libgpg-error + libsodium + miniupnpc + qtbase + qtdeclarative + qtgraphicaleffects + qtmultimedia + qtquickcontrols + qtquickcontrols2 + qtxmlpatterns + quirc + randomx + rapidjson + unbound + zeromq + ] + ++ lib.optionals stdenv.isDarwin [ qtmacextras ] + ++ lib.optionals trezorSupport [ + hidapi + libusb1 + protobuf_21 + python3 + udev + ]; postUnpack = '' # copy monero sources here @@ -68,7 +111,12 @@ stdenv.mkDerivation rec { --replace 'add_subdirectory(external)' "" ''; - cmakeFlags = [ "-DARCH=default" ]; + cmakeFlags = + [ "-DARCH=default" ] + ++ lib.optional trezorSupport [ + # fix build on recent gcc versions + "-DCMAKE_CXX_FLAGS=-fpermissive" + ]; desktopItem = makeDesktopItem { name = "monero-wallet-gui"; @@ -76,7 +124,7 @@ stdenv.mkDerivation rec { icon = "monero"; desktopName = "Monero"; genericName = "Wallet"; - categories = [ "Network" "Utility" ]; + categories = [ "Network" "Utility" ]; }; postInstall = '' @@ -93,12 +141,12 @@ stdenv.mkDerivation rec { done; ''; - meta = with lib; { - description = "Private, secure, untraceable currency"; - homepage = "https://getmonero.org/"; - license = licenses.bsd3; - platforms = platforms.all; - maintainers = with maintainers; [ rnhmjoj ]; - mainProgram = "monero-wallet-gui"; + meta = { + description = "Private, secure, untraceable currency"; + homepage = "https://getmonero.org/"; + license = lib.licenses.bsd3; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ rnhmjoj ]; + mainProgram = "monero-wallet-gui"; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f2c1c9b47222..883cd1344453 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34933,7 +34933,7 @@ with pkgs; lndmanage = callPackage ../applications/blockchains/lndmanage { }; monero-cli = callPackage ../applications/blockchains/monero-cli { - inherit (darwin.apple_sdk.frameworks) CoreData IOKit PCSC; + inherit (darwin.apple_sdk.frameworks) CoreData IOKit; }; haven-cli = callPackage ../applications/blockchains/haven-cli {