From ef9bcf24ca2ee5c6d348b1b95c3a8d59aba33490 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 21 Nov 2021 19:27:08 +0100 Subject: [PATCH 1/2] bitcoin-knots: 0.20.0.knots20200614 -> 22.0.knots20211108 make bitcoin-knots/default.nix much more similar to bitcoin/default.nix to simplify maintenance --- .../blockchains/bitcoin-knots/default.nix | 96 +++++++++++++------ pkgs/top-level/all-packages.nix | 7 +- 2 files changed, 75 insertions(+), 28 deletions(-) diff --git a/pkgs/applications/blockchains/bitcoin-knots/default.nix b/pkgs/applications/blockchains/bitcoin-knots/default.nix index eea836ac62d3..803e27969e7a 100644 --- a/pkgs/applications/blockchains/bitcoin-knots/default.nix +++ b/pkgs/applications/blockchains/bitcoin-knots/default.nix @@ -1,41 +1,83 @@ -{ lib, stdenv -, fetchFromGitHub -, pkg-config +{ lib +, stdenv +, fetchurl , autoreconfHook -, db5 -, openssl -, boost -, zlib -, miniupnpc -, libevent -, protobuf +, pkg-config , util-linux +, hexdump +, autoSignDarwinBinariesHook +, wrapQtAppsHook ? null +, boost +, libevent +, miniupnpc +, zeromq +, zlib +, db48 +, sqlite +, qrencode +, qtbase ? null +, qttools ? null +, python3 +, nixosTests +, withGui +, withWallet ? true }: +with lib; stdenv.mkDerivation rec { - pname = "bitcoind-knots"; - version = "0.20.0"; - versionDate = "20200614"; + pname = if withGui then "bitcoin-knots" else "bitcoind-knots"; + version = "22.0.knots20211108"; - src = fetchFromGitHub { - owner = "bitcoinknots"; - repo = "bitcoin"; - rev = "v${version}.knots${versionDate}"; - sha256 = "0c8k1154kcwz6q2803wx0zigvqaij1fi5akgfqlj3yl57jjw48jj"; + src = fetchurl { + url = "https://bitcoinknots.org/files/22.x/${version}/guix/bitcoin-${version}.tar.gz"; + sha256 = "04sqbx4sp3bzwbl8z53nz96n3s0590h327ih0mbgyvfvl3b8pj4i"; }; - nativeBuildInputs = [ pkg-config autoreconfHook ]; - buildInputs = [ openssl db5 openssl util-linux - protobuf boost zlib miniupnpc libevent ]; + nativeBuildInputs = + [ autoreconfHook pkg-config ] + ++ optionals stdenv.isLinux [ util-linux ] + ++ optionals stdenv.isDarwin [ hexdump ] + ++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ] + ++ optionals withGui [ wrapQtAppsHook ]; - configureFlags = [ "--with-incompatible-bdb" - "--with-boost-libdir=${boost.out}/lib" ]; + buildInputs = [ boost libevent miniupnpc zeromq zlib ] + ++ optionals withWallet [ db48 sqlite ] + ++ optionals withGui [ qrencode qtbase qttools ]; - meta = with lib; { - description = "An enhanced Bitcoin node software"; + configureFlags = [ + "--with-boost-libdir=${boost.out}/lib" + "--disable-bench" + ] ++ optionals (!doCheck) [ + "--disable-tests" + "--disable-gui-tests" + ] ++ optionals (!withWallet) [ + "--disable-wallet" + ] ++ optionals withGui [ + "--with-gui=qt5" + "--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin" + ]; + + checkInputs = [ python3 ]; + + doCheck = true; + + checkFlags = + [ "LC_ALL=en_US.UTF-8" ] + # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI. + # See also https://github.com/NixOS/nixpkgs/issues/24256 + ++ optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}"; + + enableParallelBuilding = true; + + passthru.tests = { + smoke-test = nixosTests.bitcoind-knots; + }; + + meta = { + description = "A derivative of Bitcoin Core with a collection of improvements"; homepage = "https://bitcoinknots.org/"; + maintainers = with maintainers; [ prusnak mmahut ]; license = licenses.mit; - maintainers = [ maintainers.mmahut ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f927c1883bb3..c3c68851e690 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29627,7 +29627,12 @@ with pkgs; inherit (darwin) autoSignDarwinBinariesHook; }; - bitcoind-knots = callPackage ../applications/blockchains/bitcoin-knots { miniupnpc = miniupnpc_2; }; + bitcoind-knots = callPackage ../applications/blockchains/bitcoin-knots { + boost = boost17x; + miniupnpc = miniupnpc_2; + withGui = false; + inherit (darwin) autoSignDarwinBinariesHook; + }; cgminer = callPackage ../applications/blockchains/cgminer { }; From 783dbd1ba87c1f5e8624c140f0c7d1f0f0cdc182 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 21 Nov 2021 20:01:05 +0100 Subject: [PATCH 2/2] bitcoin: fix tests on darwin by using en_US.UTF-8 instead of C.UTF-8 --- pkgs/applications/blockchains/bitcoin/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/bitcoin/default.nix b/pkgs/applications/blockchains/bitcoin/default.nix index 7253d3dff377..e1a0dd207a0a 100644 --- a/pkgs/applications/blockchains/bitcoin/default.nix +++ b/pkgs/applications/blockchains/bitcoin/default.nix @@ -79,7 +79,7 @@ stdenv.mkDerivation rec { doCheck = true; checkFlags = - [ "LC_ALL=C.UTF-8" ] + [ "LC_ALL=en_US.UTF-8" ] # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI. # See also https://github.com/NixOS/nixpkgs/issues/24256 ++ optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";