summary refs log tree commit diff
path: root/pkgs/applications/blockchains/monero/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/blockchains/monero/default.nix')
-rw-r--r--pkgs/applications/blockchains/monero/default.nix40
1 files changed, 27 insertions, 13 deletions
diff --git a/pkgs/applications/blockchains/monero/default.nix b/pkgs/applications/blockchains/monero/default.nix
index f1186564119..7dd2e569021 100644
--- a/pkgs/applications/blockchains/monero/default.nix
+++ b/pkgs/applications/blockchains/monero/default.nix
@@ -1,46 +1,60 @@
-{ stdenv, fetchFromGitHub
-, cmake, pkgconfig
+{ lib, stdenv, fetchFromGitHub, fetchpatch
+, cmake, pkg-config
 , boost, miniupnpc, openssl, unbound
 , zeromq, pcsclite, readline, libsodium, hidapi
-, protobuf, randomx, rapidjson, libusb-compat-0_1
+, randomx, rapidjson
 , CoreData, IOKit, PCSC
+, trezorSupport ? true, libusb1, protobuf, python3
 }:
 
-assert stdenv.isDarwin -> IOKit != null;
-
 stdenv.mkDerivation rec {
   pname = "monero";
-  version = "0.16.0.3";
+  version = "0.17.2.0";
 
   src = fetchFromGitHub {
     owner = "monero-project";
     repo = "monero";
     rev = "v${version}";
-    sha256 = "1r9x3712vhb24dxxirfiwj5f9x0h4m7x0ngiiavf5983dfdlgz33";
+    sha256 = "0jwlmrpzisvw1c06cvd5b3s3hd4w0pa1qmrypfwah67qj3x6hnb6";
     fetchSubmodules = true;
   };
 
-  nativeBuildInputs = [ cmake pkgconfig ];
+  patches = [
+    ./use-system-libraries.patch
+  ];
+
+  postPatch = ''
+    # remove vendored libraries
+    rm -r external/{miniupnp,randomx,rapidjson,unbound}
+    # export patched source for monero-gui
+    cp -r . $source
+  '';
+
+  nativeBuildInputs = [ cmake pkg-config ];
 
   buildInputs = [
     boost miniupnpc openssl unbound
     zeromq pcsclite readline
     libsodium hidapi randomx rapidjson
-    protobuf libusb-compat-0_1
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ];
+    protobuf
+  ] ++ lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ]
+    ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ];
 
   cmakeFlags = [
     "-DCMAKE_BUILD_TYPE=Release"
     "-DUSE_DEVICE_TREZOR=ON"
     "-DBUILD_GUI_DEPS=ON"
     "-DReadline_ROOT_DIR=${readline.dev}"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
+    "-DRandomX_ROOT_DIR=${randomx}"
+  ] ++ lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
+
+  outputs = [ "out" "source" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Private, secure, untraceable currency";
     homepage    = "https://getmonero.org/";
     license     = licenses.bsd3;
     platforms   = platforms.all;
-    maintainers = with maintainers; [ ehmry rnhmjoj ];
+    maintainers = with maintainers; [ rnhmjoj ];
   };
 }