nixpkgs/pkgs/applications/blockchains/clightning/default.nix
Peter Neuroth d39c8a2bf6
clightning: add sigining for darwin
We need this for darwin-aarch64 support
2022-03-04 15:56:48 +01:00

72 lines
2.2 KiB
Nix

{ lib
, stdenv
, darwin
, fetchurl
, autoconf
, automake
, autogen
, gettext
, libtool
, pkg-config
, unzip
, which
, gmp
, libsodium
, python3
, sqlite
, zlib
}:
let
py3 = python3.withPackages (p: [ p.Mako p.mrkd ]);
in
stdenv.mkDerivation rec {
pname = "clightning";
version = "0.10.2";
src = fetchurl {
url = "https://github.com/ElementsProject/lightning/releases/download/v${version}/clightning-v${version}.zip";
sha256 = "3c9dcb686217b2efe0e988e90b95777c4591e3335e259e01a94af87e0bf01809";
};
# 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.
nativeBuildInputs = [ autogen autoconf automake gettext pkg-config py3 unzip which ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ] ++ [ libtool ];
buildInputs = [ gmp libsodium sqlite zlib ];
# 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 ''
patchShebangs \
tools/generate-wire.py \
tools/update-mocks.sh \
tools/mockup.sh \
devtools/sql-rewrite.py
'' else ''
substituteInPlace external/libwally-core/tools/autogen.sh --replace gsed sed && \
substituteInPlace external/libwally-core/configure.ac --replace gsed sed
'';
configureFlags = [ "--disable-developer" "--disable-valgrind" ];
makeFlags = [ "VERSION=v${version}" ];
enableParallelBuilding = true;
meta = with lib; {
description = "A Bitcoin Lightning Network implementation in C";
longDescription = ''
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";
maintainers = with maintainers; [ jb55 prusnak ];
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
};
}