Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / blockchains / groestlcoin / default.nix
blob6e7cb1d58cd366844ebdf0b695e5bed350e1f59b
1 { lib
2 , stdenv
3 , fetchurl
4 , fetchFromGitHub
5 , autoreconfHook
6 , pkg-config
7 , util-linux
8 , hexdump
9 , autoSignDarwinBinariesHook
10 , wrapQtAppsHook ? null
11 , boost
12 , libevent
13 , miniupnpc
14 , zeromq
15 , zlib
16 , db53
17 , sqlite
18 , qrencode
19 , qtbase ? null
20 , qttools ? null
21 , python3
22 , withGui ? false
23 , withWallet ? true
26 let
27   desktop = fetchurl {
28     # de45048 is the last commit when the debian/groestlcoin-qt.desktop file was changed
29     url = "https://raw.githubusercontent.com/Groestlcoin/packaging/de4504844e47cf2c7604789650a5db4f3f7a48aa/debian/groestlcoin-qt.desktop";
30     sha256 = "0mxwq4jvcip44a796iwz7n1ljkhl3a4p47z7qlsxcfxw3zmm0k0k";
31   };
33 stdenv.mkDerivation rec {
34   pname = if withGui then "groestlcoin" else "groestlcoind";
35   version = "25.0";
37   src = fetchFromGitHub {
38     owner = "Groestlcoin";
39     repo = "groestlcoin";
40     rev = "v${version}";
41     sha256 = "03w5n3qjha63mgj7zk8q17x5j63la3i4li7bf5i1yw59ijqpmnqg";
42   };
44   nativeBuildInputs = [ autoreconfHook pkg-config ]
45     ++ lib.optionals stdenv.isLinux [ util-linux ]
46     ++ lib.optionals stdenv.isDarwin [ hexdump ]
47     ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]
48     ++ lib.optionals withGui [ wrapQtAppsHook ];
50   buildInputs = [ boost libevent miniupnpc zeromq zlib ]
51     ++ lib.optionals withWallet [ db53 sqlite ]
52     ++ lib.optionals withGui [ qrencode qtbase qttools ];
54   postInstall = lib.optionalString withGui ''
55     install -Dm644 ${desktop} $out/share/applications/groestlcoin-qt.desktop
56     substituteInPlace $out/share/applications/groestlcoin-qt.desktop --replace "Icon=groestlcoin128" "Icon=groestlcoin"
57     install -Dm644 share/pixmaps/groestlcoin256.png $out/share/pixmaps/groestlcoin.png
58   '';
60   configureFlags = [
61     "--with-boost-libdir=${boost.out}/lib"
62     "--disable-bench"
63   ] ++ lib.optionals (!withWallet) [
64     "--disable-wallet"
65   ] ++ lib.optionals withGui [
66     "--with-gui=qt5"
67     "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
68   ];
70   nativeCheckInputs = [ python3 ];
72   checkFlags = [ "LC_ALL=en_US.UTF-8" ]
73     # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Groestlcoin's GUI.
74     # See also https://github.com/NixOS/nixpkgs/issues/24256
75     ++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
77   enableParallelBuilding = true;
79   meta = with lib; {
80     description = "Peer-to-peer electronic cash system";
81     longDescription = ''
82       Groestlcoin is a free open source peer-to-peer electronic cash system that is
83       completely decentralized, without the need for a central server or trusted
84       parties. Users hold the crypto keys to their own money and transact directly
85       with each other, with the help of a P2P network to check for double-spending.
86     '';
87     homepage = "https://groestlcoin.org/";
88     downloadPage = "https://github.com/Groestlcoin/groestlcoin/releases/tag/v{version}/";
89     maintainers = with maintainers; [ gruve-p ];
90     license = licenses.mit;
91     platforms = platforms.unix;
92   };