summary refs log tree commit diff
path: root/pkgs/applications/blockchains/monero-gui
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2020-10-06 21:14:52 +0200
committerrnhmjoj <rnhmjoj@inventati.org>2020-10-08 00:09:41 +0200
commit059292cc64d241fd8196db82423d8d195b57904e (patch)
treed51c1bf9f097f121edbefc272e9e46384d451ea0 /pkgs/applications/blockchains/monero-gui
parent59fe3e87c32e13f02e84924c3153e0bbd61a6fc6 (diff)
downloadnixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar.gz
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar.bz2
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar.lz
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar.xz
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.tar.zst
nixpkgs-059292cc64d241fd8196db82423d8d195b57904e.zip
monero-gui: use the cmake build system
Diffstat (limited to 'pkgs/applications/blockchains/monero-gui')
-rw-r--r--pkgs/applications/blockchains/monero-gui/default.nix76
1 files changed, 45 insertions, 31 deletions
diff --git a/pkgs/applications/blockchains/monero-gui/default.nix b/pkgs/applications/blockchains/monero-gui/default.nix
index 6aa7befc5f0..2f4edca7301 100644
--- a/pkgs/applications/blockchains/monero-gui/default.nix
+++ b/pkgs/applications/blockchains/monero-gui/default.nix
@@ -1,15 +1,23 @@
 { stdenv, wrapQtAppsHook, makeDesktopItem
-, fetchFromGitHub, qmake, qttools, pkgconfig
+, fetchFromGitHub
+, cmake, qttools, pkgconfig
 , qtbase, qtdeclarative, qtgraphicaleffects
 , qtmultimedia, qtxmlpatterns
 , qtquickcontrols, qtquickcontrols2
-, monero, unbound, readline, boost, libunwind
-, libsodium, pcsclite, zeromq, libgcrypt, libgpgerror
-, hidapi, libusb-compat-0_1, protobuf, randomx
+, monero, miniupnpc, unbound, readline
+, boost, libunwind, libsodium, pcsclite
+, randomx, zeromq, libgcrypt, libgpgerror
+, hidapi, rapidjson
+, trezorSupport ? true
+,   libusb1  ? null
+,   protobuf ? null
+,   python3  ? null
 }:
 
 with stdenv.lib;
 
+assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
+
 stdenv.mkDerivation rec {
   pname = "monero-gui";
   version = "0.17.0.1";
@@ -21,43 +29,49 @@ stdenv.mkDerivation rec {
     sha256 = "1i9a3ampppyzsl4sllbqlr3w43sjpb3fdfxhb1j4n49p8g0jzmf3";
   };
 
-  nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
+  nativeBuildInputs = [
+    cmake pkgconfig wrapQtAppsHook
+    (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
+  ] ++ optionals trezorSupport [ libusb1 protobuf python3 ];
 
-  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 ];
 
   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}'
+    substituteInPlace monero/src/version.cpp.in \
+      --replace '@VERSION_IS_RELEASE@' 'true'
+
+    # 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
+    # only build external deps, *not* the full monero
+    substituteInPlace CMakeLists.txt \
+      --replace 'add_subdirectory(monero)' \
+                'add_subdirectory(monero EXCLUDE_FROM_ALL)'
   '';
 
+  cmakeFlags = [ "-DCMAKE_INSTALL_PREFIX=$out/bin" ];
+
   desktopItem = makeDesktopItem {
     name = "monero-wallet-gui";
     exec = "monero-wallet-gui";
@@ -69,15 +83,15 @@ 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;
   '';