summary refs log tree commit diff
path: root/pkgs/applications/blockchains/monero-gui/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/blockchains/monero-gui/default.nix')
-rw-r--r--pkgs/applications/blockchains/monero-gui/default.nix89
1 files changed, 50 insertions, 39 deletions
diff --git a/pkgs/applications/blockchains/monero-gui/default.nix b/pkgs/applications/blockchains/monero-gui/default.nix
index 6ea075e2a36..d7a27dd4bcc 100644
--- a/pkgs/applications/blockchains/monero-gui/default.nix
+++ b/pkgs/applications/blockchains/monero-gui/default.nix
@@ -1,63 +1,75 @@
-{ stdenv, wrapQtAppsHook, makeDesktopItem
-, fetchFromGitHub, qmake, qttools, pkgconfig
+{ lib, stdenv, wrapQtAppsHook, makeDesktopItem
+, fetchFromGitHub
+, cmake, qttools, pkg-config
 , qtbase, qtdeclarative, qtgraphicaleffects
 , qtmultimedia, qtxmlpatterns
 , qtquickcontrols, qtquickcontrols2
-, monero, unbound, readline, boost, libunwind
-, libsodium, pcsclite, zeromq, libgcrypt, libgpgerror
-, hidapi, libusb-compat-0_1, protobuf, randomx
+, qtmacextras
+, monero, miniupnpc, unbound, readline
+, boost, libunwind, libsodium, pcsclite
+, randomx, zeromq, libgcrypt, libgpgerror
+, hidapi, rapidjson, quirc
+, trezorSupport ? true, libusb1, protobuf, python3
 }:
 
-with stdenv.lib;
-
 stdenv.mkDerivation rec {
   pname = "monero-gui";
-  version = "0.16.0.3";
+  version = "0.17.2.2";
 
   src = fetchFromGitHub {
     owner  = "monero-project";
     repo   = "monero-gui";
     rev    = "v${version}";
-    sha256 = "0iwjp8x5swy8i8pzrlm5v55awhm54cf48pm1vz98lcq361lhfzk6";
+    sha256 = "1k3grbd3wydy5gv6d8x35skv1v97lhh6awd9i87im9lz4kn8ywkd";
   };
 
-  nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
+  nativeBuildInputs = [
+    cmake pkg-config wrapQtAppsHook
+    (lib.getDev qttools)
+  ];
 
   buildInputs = [
     qtbase qtdeclarative qtgraphicaleffects
     qtmultimedia qtquickcontrols qtquickcontrols2
     qtxmlpatterns
-    monero unbound readline libgcrypt libgpgerror
-    boost libunwind libsodium pcsclite zeromq
-    hidapi libusb-compat-0_1 protobuf randomx
-  ];
+    monero miniupnpc unbound readline
+    randomx libgcrypt libgpgerror
+    boost libunwind libsodium pcsclite
+    zeromq hidapi rapidjson quirc
+  ] ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ]
+    ++ lib.optionals stdenv.isDarwin [ qtmacextras ];
 
-  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-security" ];
+  postUnpack = ''
+    # copy monero sources here
+    # (needs to be writable)
+    cp -r ${monero.source}/* source/monero
+    chmod -R +w source/monero
+  '';
 
-  patches = [ ./move-log-file.patch ];
+  patches = [
+    ./move-log-file.patch
+    ./use-system-libquirc.patch
+  ];
 
   postPatch = ''
-    echo '
-      var GUI_VERSION = "${version}";
-      var GUI_MONERO_VERSION = "${getVersion monero}";
-    ' > version.js
-    substituteInPlace monero-wallet-gui.pro \
-      --replace '$$[QT_INSTALL_BINS]/lrelease' '${getDev qttools}/bin/lrelease'
+    # set monero-gui version
+    substituteInPlace src/version.js.in \
+       --replace '@VERSION_TAG_GUI@' '${version}'
+
+    # use monerod from the monero package
     substituteInPlace src/daemon/DaemonManager.cpp \
       --replace 'QApplication::applicationDirPath() + "' '"${monero}/bin'
-  '';
-
-  makeFlags = [ "INSTALL_ROOT=$(out)" ];
 
-  preBuild = ''
-    sed -i s#/opt/monero-wallet-gui##g Makefile
-    make -C src/zxcvbn-c
-
-    # use nixpkgs monero sources
-    rmdir monero
-    ln -s "${monero.src}" monero
+    # 1: only build external deps, *not* the full monero
+    # 2: use nixpkgs libraries
+    substituteInPlace CMakeLists.txt \
+      --replace 'add_subdirectory(monero)' \
+                'add_subdirectory(monero EXCLUDE_FROM_ALL)' \
+      --replace 'add_subdirectory(external)' ""
   '';
 
+  cmakeFlags = [ "-DARCH=default" ];
+
   desktopItem = makeDesktopItem {
     name = "monero-wallet-gui";
     exec = "monero-wallet-gui";
@@ -69,24 +81,23 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     # install desktop entry
-    mkdir -p $out/share/applications
-    cp ${desktopItem}/share/applications/* $out/share/applications
+    install -Dm644 -t $out/share/applications \
+      ${desktopItem}/share/applications/*
 
     # install icons
     for n in 16 24 32 48 64 96 128 256; do
       size=$n"x"$n
-      mkdir -p $out/share/icons/hicolor/$size/apps
-      cp $src/images/appicons/$size.png \
-         $out/share/icons/hicolor/$size/apps/monero.png
+      install -Dm644 \
+        -t $out/share/icons/hicolor/$size/apps/monero.png \
+        $src/images/appicons/$size.png
     done;
   '';
 
-  meta = {
+  meta = with lib; {
     description  = "Private, secure, untraceable currency";
     homepage     = "https://getmonero.org/";
     license      = licenses.bsd3;
     platforms    = platforms.all;
-    badPlatforms = platforms.darwin;
     maintainers  = with maintainers; [ rnhmjoj ];
   };
 }