2021-07-16 19:40:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-01-13 20:06:32 +00:00
|
|
|
, fetchFromGitHub
|
2021-07-16 19:40:57 +00:00
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, util-linux
|
|
|
|
, hexdump
|
2022-09-22 12:36:57 +00:00
|
|
|
, autoSignDarwinBinariesHook
|
2021-07-16 19:40:57 +00:00
|
|
|
, wrapQtAppsHook ? null
|
|
|
|
, boost
|
|
|
|
, libevent
|
|
|
|
, miniupnpc
|
|
|
|
, zeromq
|
|
|
|
, zlib
|
|
|
|
, db48
|
|
|
|
, sqlite
|
|
|
|
, qrencode
|
|
|
|
, qtbase ? null
|
|
|
|
, qttools ? null
|
|
|
|
, python3
|
|
|
|
, withGui
|
|
|
|
, withWallet ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = if withGui then "elements" else "elementsd";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "22.1.1";
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ElementsProject";
|
|
|
|
repo = "elements";
|
|
|
|
rev = "elements-${version}";
|
2023-04-12 12:48:02 +00:00
|
|
|
sha256 = "sha256-V8Ym4dGshf2E6KsboALXn1DJ5nL3QQvMmVMNdjSw7B8=";
|
2021-07-16 19:40:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs =
|
|
|
|
[ autoreconfHook pkg-config ]
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ util-linux ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ hexdump ]
|
|
|
|
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]
|
|
|
|
++ lib.optionals withGui [ wrapQtAppsHook ];
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
buildInputs = [ boost libevent miniupnpc zeromq zlib ]
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optionals withWallet [ db48 sqlite ]
|
|
|
|
++ lib.optionals withGui [ qrencode qtbase qttools ];
|
2021-07-16 19:40:57 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-boost-libdir=${boost.out}/lib"
|
|
|
|
"--disable-bench"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals (!doCheck) [
|
2021-07-16 19:40:57 +00:00
|
|
|
"--disable-tests"
|
|
|
|
"--disable-gui-tests"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals (!withWallet) [
|
2021-07-16 19:40:57 +00:00
|
|
|
"--disable-wallet"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals withGui [
|
2021-07-16 19:40:57 +00:00
|
|
|
"--with-gui=qt5"
|
|
|
|
"--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
|
|
|
|
];
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
# fix "Killed: 9 test/test_bitcoin"
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/179474
|
|
|
|
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "fortify" "stackprotector" ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ python3 ];
|
2021-07-16 19:40:57 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkFlags =
|
2022-09-22 12:36:57 +00:00
|
|
|
[ "LC_ALL=en_US.UTF-8" ]
|
2021-07-16 19:40:57 +00:00
|
|
|
# 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
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
|
2021-07-16 19:40:57 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
2021-07-16 19:40:57 +00:00
|
|
|
description = "Open Source implementation of advanced blockchain features extending the Bitcoin protocol";
|
|
|
|
longDescription= ''
|
|
|
|
The Elements blockchain platform is a collection of feature experiments and extensions to the
|
|
|
|
Bitcoin protocol. This platform enables anyone to build their own businesses or networks
|
|
|
|
pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset
|
|
|
|
tokens.
|
|
|
|
'';
|
|
|
|
homepage = "https://www.github.com/ElementsProject/elements";
|
|
|
|
maintainers = with maintainers; [ prusnak ];
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|