2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-03-10 19:12:11 +00:00
|
|
|
, darwin
|
2021-02-05 17:12:51 +00:00
|
|
|
, fetchurl
|
|
|
|
, autoconf
|
|
|
|
, autogen
|
2022-09-09 14:08:57 +00:00
|
|
|
, automake
|
2021-02-05 17:12:51 +00:00
|
|
|
, gettext
|
|
|
|
, libtool
|
2022-10-21 18:38:19 +00:00
|
|
|
, lowdown
|
2022-09-09 14:08:57 +00:00
|
|
|
, protobuf
|
2021-02-05 17:12:51 +00:00
|
|
|
, unzip
|
|
|
|
, which
|
|
|
|
, gmp
|
|
|
|
, libsodium
|
|
|
|
, python3
|
|
|
|
, sqlite
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
let
|
2022-09-09 14:08:57 +00:00
|
|
|
py3 = python3.withPackages (p: [ p.Mako ]);
|
2021-02-05 17:12:51 +00:00
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "clightning";
|
2023-03-08 16:32:21 +00:00
|
|
|
version = "23.02";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/ElementsProject/lightning/releases/download/v${version}/clightning-v${version}.zip";
|
2023-03-08 16:32:21 +00:00
|
|
|
sha256 = "sha256-uvk7sApIwlrkH8eERBetf/nsAkN2d35T/IEtICFflzY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
# when building on darwin we need dawin.cctools to provide the correct libtool
|
|
|
|
# as libwally-core detects the host as darwin and tries to add the -static
|
|
|
|
# option to libtool, also we have to add the modified gsed package.
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [ autoconf autogen automake gettext libtool lowdown protobuf py3 unzip which ]
|
2022-09-09 14:08:57 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
buildInputs = [ gmp libsodium sqlite zlib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
# this causes some python trouble on a darwin host so we skip this step.
|
|
|
|
# also we have to tell libwally-core to use sed instead of gsed.
|
|
|
|
postPatch = if !stdenv.isDarwin then ''
|
2020-04-24 23:36:52 +00:00
|
|
|
patchShebangs \
|
|
|
|
tools/generate-wire.py \
|
|
|
|
tools/update-mocks.sh \
|
|
|
|
tools/mockup.sh \
|
|
|
|
devtools/sql-rewrite.py
|
2022-03-10 19:12:11 +00:00
|
|
|
'' else ''
|
|
|
|
substituteInPlace external/libwally-core/tools/autogen.sh --replace gsed sed && \
|
|
|
|
substituteInPlace external/libwally-core/configure.ac --replace gsed sed
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
configureFlags = [ "--disable-developer" "--disable-valgrind" ];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
makeFlags = [ "VERSION=v${version}" ];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A Bitcoin Lightning Network implementation in C";
|
2021-02-05 17:12:51 +00:00
|
|
|
longDescription = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
c-lightning is a standard compliant implementation of the Lightning
|
|
|
|
Network protocol. The Lightning Network is a scalability solution for
|
|
|
|
Bitcoin, enabling secure and instant transfer of funds between any two
|
|
|
|
parties for any amount.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/ElementsProject/lightning";
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with maintainers; [ jb55 prusnak ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2022-03-10 19:12:11 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|