1{ lib
2, stdenv
3, fetchurl
4, autoreconfHook
5, pkg-config
6, util-linux
7, hexdump
8, wrapQtAppsHook ? null
9, boost
10, libevent
11, miniupnpc
12, zeromq
13, zlib
14, db48
15, sqlite
16, qrencode
17, qtbase ? null
18, qttools ? null
19, python3
20, withGui
21, withWallet ? true
22}:
23
24with lib;
25stdenv.mkDerivation rec {
26 pname = if withGui then "elements" else "elementsd";
27 version = "0.21.0";
28
29 src = fetchurl {
30 url = "https://github.com/ElementsProject/elements/archive/elements-${version}.tar.gz";
31 sha256 = "0d9mcb0nw9qqhv0jhpddi9i4iry3w7b5jifsl5kpcw82qrkvgfgj";
32 };
33
34 nativeBuildInputs =
35 [ autoreconfHook pkg-config ]
36 ++ optionals stdenv.isLinux [ util-linux ]
37 ++ optionals stdenv.isDarwin [ hexdump ]
38 ++ optionals withGui [ wrapQtAppsHook ];
39
40 buildInputs = [ boost libevent miniupnpc zeromq zlib ]
41 ++ optionals withWallet [ db48 sqlite ]
42 ++ optionals withGui [ qrencode qtbase qttools ];
43
44 configureFlags = [
45 "--with-boost-libdir=${boost.out}/lib"
46 "--disable-bench"
47 ] ++ optionals (!doCheck) [
48 "--disable-tests"
49 "--disable-gui-tests"
50 ] ++ optionals (!withWallet) [
51 "--disable-wallet"
52 ] ++ optionals withGui [
53 "--with-gui=qt5"
54 "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
55 ];
56
57 checkInputs = [ python3 ];
58
59 doCheck = true;
60
61 checkFlags =
62 [ "LC_ALL=C.UTF-8" ]
63 # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
64 # See also https://github.com/NixOS/nixpkgs/issues/24256
65 ++ optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
66
67 enableParallelBuilding = true;
68
69 meta = {
70 description = "Open Source implementation of advanced blockchain features extending the Bitcoin protocol";
71 longDescription= ''
72 The Elements blockchain platform is a collection of feature experiments and extensions to the
73 Bitcoin protocol. This platform enables anyone to build their own businesses or networks
74 pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset
75 tokens.
76 '';
77 homepage = "https://www.github.com/ElementsProject/elements";
78 maintainers = with maintainers; [ prusnak ];
79 license = licenses.mit;
80 platforms = platforms.unix;
81 };
82}