2021-01-21 10:10:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-03-03 12:57:36 +00:00
|
|
|
, darwin
|
2021-01-21 10:10:41 +00:00
|
|
|
, fetchurl
|
|
|
|
, autoconf
|
|
|
|
, autogen
|
2022-08-26 09:03:08 +00:00
|
|
|
, automake
|
2021-01-21 10:10:41 +00:00
|
|
|
, gettext
|
|
|
|
, libtool
|
2022-10-10 21:58:29 +00:00
|
|
|
, lowdown
|
2022-08-26 09:03:08 +00:00
|
|
|
, protobuf
|
2021-01-21 10:10:41 +00:00
|
|
|
, unzip
|
|
|
|
, which
|
|
|
|
, gmp
|
2021-01-25 18:23:58 +00:00
|
|
|
, libsodium
|
2021-01-21 10:10:41 +00:00
|
|
|
, python3
|
|
|
|
, sqlite
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
let
|
2023-02-19 17:28:43 +00:00
|
|
|
py3 = python3.withPackages (p: [ p.mako ]);
|
2021-01-21 10:10:41 +00:00
|
|
|
in
|
2018-06-21 02:48:12 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "clightning";
|
2023-12-27 08:27:41 +00:00
|
|
|
version = "23.11.2";
|
2019-03-04 12:21:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/ElementsProject/lightning/releases/download/v${version}/clightning-v${version}.zip";
|
2023-12-27 08:27:41 +00:00
|
|
|
sha256 = "sha256-n1+9Q493N/N5sr7sVpzhObtbKpEejsNUUhhbYPukveg=";
|
2018-06-21 02:48:12 +00:00
|
|
|
};
|
|
|
|
|
2022-03-03 12:57:36 +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-10 21:58:29 +00:00
|
|
|
nativeBuildInputs = [ autoconf autogen automake gettext libtool lowdown protobuf py3 unzip which ]
|
2022-08-26 09:03:08 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ];
|
2018-06-21 02:48:12 +00:00
|
|
|
|
2021-01-25 18:23:58 +00:00
|
|
|
buildInputs = [ gmp libsodium sqlite zlib ];
|
2018-06-21 02:48:12 +00:00
|
|
|
|
2022-03-03 12:57:36 +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 ''
|
2019-08-30 12:34:39 +00:00
|
|
|
patchShebangs \
|
|
|
|
tools/generate-wire.py \
|
|
|
|
tools/update-mocks.sh \
|
2019-10-29 07:52:43 +00:00
|
|
|
tools/mockup.sh \
|
2023-09-05 23:05:59 +00:00
|
|
|
devtools/sql-rewrite.py \
|
|
|
|
plugins/clnrest/clnrest.py
|
2022-03-03 12:57:36 +00:00
|
|
|
'' else ''
|
|
|
|
substituteInPlace external/libwally-core/tools/autogen.sh --replace gsed sed && \
|
|
|
|
substituteInPlace external/libwally-core/configure.ac --replace gsed sed
|
2018-06-21 02:48:12 +00:00
|
|
|
'';
|
|
|
|
|
2023-11-29 09:56:34 +00:00
|
|
|
configureFlags = [ "--disable-valgrind" ];
|
2021-01-21 10:10:41 +00:00
|
|
|
|
2021-11-18 17:43:16 +00:00
|
|
|
makeFlags = [ "VERSION=v${version}" ];
|
2021-01-21 10:10:41 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2018-06-21 02:48:12 +00:00
|
|
|
|
2023-11-29 09:56:34 +00:00
|
|
|
# workaround for build issue, happens only x86_64-darwin, not aarch64-darwin
|
|
|
|
# ccan/ccan/fdpass/fdpass.c:16:8: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
|
|
|
|
# char buf[CMSG_SPACE(sizeof(fd))];
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) "-Wno-error=gnu-folding-constant";
|
|
|
|
|
2021-01-21 10:10:41 +00:00
|
|
|
meta = with lib; {
|
2018-06-21 02:48:12 +00:00
|
|
|
description = "A Bitcoin Lightning Network implementation in C";
|
2021-01-21 10:10:41 +00:00
|
|
|
longDescription = ''
|
2018-06-21 02:48:12 +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.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/ElementsProject/lightning";
|
2021-01-21 10:10:41 +00:00
|
|
|
maintainers = with maintainers; [ jb55 prusnak ];
|
2018-06-21 02:48:12 +00:00
|
|
|
license = licenses.mit;
|
2022-03-04 14:56:48 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2018-06-21 02:48:12 +00:00
|
|
|
};
|
|
|
|
}
|