9 , autoSignDarwinBinariesHook
10 , wrapQtAppsHook ? null
26 stdenv.mkDerivation rec {
27 pname = if withGui then "elements" else "elementsd";
30 src = fetchFromGitHub {
31 owner = "ElementsProject";
33 rev = "elements-${version}";
34 sha256 = "sha256-qHtSgfZGZ4Beu5fsJAOZm8ejj7wfHBbOS6WAjOrCuw4=";
38 # upnp: fix build with miniupnpc 2.2.8
40 url = "https://github.com/bitcoin/bitcoin/commit/8acdf66540834b9f9cf28f16d389e8b6a48516d5.patch?full_index=1";
41 hash = "sha256-oDvHUvwAEp0LJCf6QBESn38Bu359TcPpLhvuLX3sm6M=";
46 [ autoreconfHook pkg-config ]
47 ++ lib.optionals stdenv.hostPlatform.isLinux [ util-linux ]
48 ++ lib.optionals stdenv.hostPlatform.isDarwin [ hexdump ]
49 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ]
50 ++ lib.optionals withGui [ wrapQtAppsHook ];
52 buildInputs = [ boost libevent miniupnpc zeromq zlib ]
53 ++ lib.optionals withWallet [ db48 sqlite ]
54 ++ lib.optionals withGui [ qrencode qtbase qttools ];
57 "--with-boost-libdir=${boost.out}/lib"
59 ] ++ lib.optionals (!doCheck) [
62 ] ++ lib.optionals (!withWallet) [
64 ] ++ lib.optionals withGui [
66 "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
69 # fix "Killed: 9 test/test_bitcoin"
70 # https://github.com/NixOS/nixpkgs/issues/179474
71 hardeningDisable = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin) [ "fortify" "stackprotector" ];
73 nativeCheckInputs = [ python3 ];
78 [ "LC_ALL=en_US.UTF-8" ]
79 # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
80 # See also https://github.com/NixOS/nixpkgs/issues/24256
81 ++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
83 enableParallelBuilding = true;
86 description = "Open Source implementation of advanced blockchain features extending the Bitcoin protocol";
88 The Elements blockchain platform is a collection of feature experiments and extensions to the
89 Bitcoin protocol. This platform enables anyone to build their own businesses or networks
90 pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset
93 homepage = "https://www.github.com/ElementsProject/elements";
94 maintainers = with maintainers; [ prusnak ];
95 license = licenses.mit;
96 platforms = platforms.unix;