10 , autoSignDarwinBinariesHook
11 , wrapQtAppsHook ? null
30 # c2e5f3e is the last commit when the debian/bitcoin-qt.desktop file was changed
31 url = "https://raw.githubusercontent.com/bitcoin-core/packaging/c2e5f3e20a8093ea02b73cbaf113bc0947b4140e/debian/bitcoin-qt.desktop";
32 sha256 = "0cpna0nxcd1dw3nnzli36nf9zj28d2g9jf5y0zl9j18lvanvniha";
35 stdenv.mkDerivation rec {
36 pname = if withGui then "bitcoin" else "bitcoind";
41 "https://bitcoincore.org/bin/bitcoin-core-${version}/bitcoin-${version}.tar.gz"
43 # hash retrieved from signed SHA256SUMS
44 sha256 = "700ae2d1e204602eb07f2779a6e6669893bc96c0dca290593f80ff8e102ff37f";
48 [ autoreconfHook pkg-config installShellFiles ]
49 ++ lib.optionals stdenv.hostPlatform.isLinux [ util-linux ]
50 ++ lib.optionals stdenv.hostPlatform.isDarwin [ hexdump ]
51 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ]
52 ++ lib.optionals withGui [ wrapQtAppsHook ];
54 buildInputs = [ boost libevent miniupnpc zeromq zlib ]
55 ++ lib.optionals withWallet [ sqlite ]
56 # building with db48 (for legacy descriptor wallet support) is broken on Darwin
57 ++ lib.optionals (withWallet && !stdenv.hostPlatform.isDarwin) [ db48 ]
58 ++ lib.optionals withGui [ qrencode qtbase qttools ];
61 installShellCompletion --bash contrib/completions/bash/bitcoin-cli.bash
62 installShellCompletion --bash contrib/completions/bash/bitcoind.bash
63 installShellCompletion --bash contrib/completions/bash/bitcoin-tx.bash
65 installShellCompletion --fish contrib/completions/fish/bitcoin-cli.fish
66 installShellCompletion --fish contrib/completions/fish/bitcoind.fish
67 installShellCompletion --fish contrib/completions/fish/bitcoin-tx.fish
68 installShellCompletion --fish contrib/completions/fish/bitcoin-util.fish
69 installShellCompletion --fish contrib/completions/fish/bitcoin-wallet.fish
70 '' + lib.optionalString withGui ''
71 installShellCompletion --fish contrib/completions/fish/bitcoin-qt.fish
73 install -Dm644 ${desktop} $out/share/applications/bitcoin-qt.desktop
74 substituteInPlace $out/share/applications/bitcoin-qt.desktop --replace "Icon=bitcoin128" "Icon=bitcoin"
75 install -Dm644 share/pixmaps/bitcoin256.png $out/share/pixmaps/bitcoin.png
78 preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
79 export MACOSX_DEPLOYMENT_TARGET=10.13
83 "--with-boost-libdir=${boost.out}/lib"
85 ] ++ lib.optionals (!doCheck) [
88 ] ++ lib.optionals (!withWallet) [
90 ] ++ lib.optionals withGui [
92 "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
95 nativeCheckInputs = [ python3 ];
100 [ "LC_ALL=en_US.UTF-8" ]
101 # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
102 # See also https://github.com/NixOS/nixpkgs/issues/24256
103 ++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
105 enableParallelBuilding = true;
108 smoke-test = nixosTests.bitcoind;
112 description = "Peer-to-peer electronic cash system";
114 Bitcoin is a free open source peer-to-peer electronic cash system that is
115 completely decentralized, without the need for a central server or trusted
116 parties. Users hold the crypto keys to their own money and transact directly
117 with each other, with the help of a P2P network to check for double-spending.
119 homepage = "https://bitcoin.org/en/";
120 downloadPage = "https://bitcoincore.org/bin/bitcoin-core-${version}/";
121 changelog = "https://bitcoincore.org/en/releases/${version}/";
122 maintainers = with maintainers; [ prusnak roconnor ];
123 license = licenses.mit;
124 platforms = platforms.unix;