nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at flake-libs 125 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch2, 6 autoreconfHook, 7 pkg-config, 8 util-linux, 9 hexdump, 10 autoSignDarwinBinariesHook, 11 wrapQtAppsHook ? null, 12 boost, 13 libevent, 14 miniupnpc, 15 zeromq, 16 zlib, 17 db48, 18 sqlite, 19 qrencode, 20 qtbase ? null, 21 qttools ? null, 22 python3, 23 withGui, 24 withWallet ? true, 25}: 26 27stdenv.mkDerivation rec { 28 pname = if withGui then "elements" else "elementsd"; 29 version = "23.2.4"; 30 31 src = fetchFromGitHub { 32 owner = "ElementsProject"; 33 repo = "elements"; 34 rev = "elements-${version}"; 35 sha256 = "sha256-UNjYkEZBjGuhkwBxSkNXjBBcLQqoan/afCLhoR2lOY4="; 36 }; 37 38 patches = [ 39 # upnp: fix build with miniupnpc 2.2.8 40 (fetchpatch2 { 41 url = "https://github.com/bitcoin/bitcoin/commit/8acdf66540834b9f9cf28f16d389e8b6a48516d5.patch?full_index=1"; 42 hash = "sha256-oDvHUvwAEp0LJCf6QBESn38Bu359TcPpLhvuLX3sm6M="; 43 }) 44 ]; 45 46 nativeBuildInputs = 47 [ 48 autoreconfHook 49 pkg-config 50 ] 51 ++ lib.optionals stdenv.hostPlatform.isLinux [ util-linux ] 52 ++ lib.optionals stdenv.hostPlatform.isDarwin [ hexdump ] 53 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ 54 autoSignDarwinBinariesHook 55 ] 56 ++ lib.optionals withGui [ wrapQtAppsHook ]; 57 58 buildInputs = 59 [ 60 boost 61 libevent 62 miniupnpc 63 zeromq 64 zlib 65 ] 66 ++ lib.optionals withWallet [ 67 db48 68 sqlite 69 ] 70 ++ lib.optionals withGui [ 71 qrencode 72 qtbase 73 qttools 74 ]; 75 76 configureFlags = 77 [ 78 "--with-boost-libdir=${boost.out}/lib" 79 "--disable-bench" 80 ] 81 ++ lib.optionals (!doCheck) [ 82 "--disable-tests" 83 "--disable-gui-tests" 84 ] 85 ++ lib.optionals (!withWallet) [ 86 "--disable-wallet" 87 ] 88 ++ lib.optionals withGui [ 89 "--with-gui=qt5" 90 "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin" 91 ]; 92 93 # fix "Killed: 9 test/test_bitcoin" 94 # https://github.com/NixOS/nixpkgs/issues/179474 95 hardeningDisable = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin) [ 96 "fortify" 97 "stackprotector" 98 ]; 99 100 nativeCheckInputs = [ python3 ]; 101 102 doCheck = true; 103 104 checkFlags = 105 [ "LC_ALL=en_US.UTF-8" ] 106 # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI. 107 # See also https://github.com/NixOS/nixpkgs/issues/24256 108 ++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}"; 109 110 enableParallelBuilding = true; 111 112 meta = with lib; { 113 description = "Open Source implementation of advanced blockchain features extending the Bitcoin protocol"; 114 longDescription = '' 115 The Elements blockchain platform is a collection of feature experiments and extensions to the 116 Bitcoin protocol. This platform enables anyone to build their own businesses or networks 117 pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset 118 tokens. 119 ''; 120 homepage = "https://www.github.com/ElementsProject/elements"; 121 maintainers = with maintainers; [ prusnak ]; 122 license = licenses.mit; 123 platforms = platforms.unix; 124 }; 125}