···1{ lib
2, stdenv
3+, darwin
4, fetchurl
5, autoconf
6, automake
···28 sha256 = "3c9dcb686217b2efe0e988e90b95777c4591e3335e259e01a94af87e0bf01809";
29 };
3031+ # when building on darwin we need dawin.cctools to provide the correct libtool
32+ # as libwally-core detects the host as darwin and tries to add the -static
33+ # option to libtool, also we have to add the modified gsed package.
34+ nativeBuildInputs = [ autogen autoconf automake gettext pkg-config py3 unzip which ]
35+ ++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ] ++ [ libtool ];
3637 buildInputs = [ gmp libsodium sqlite zlib ];
3839+ # this causes some python trouble on a darwin host so we skip this step.
40+ # also we have to tell libwally-core to use sed instead of gsed.
41+ postPatch = if !stdenv.isDarwin then ''
42 patchShebangs \
43 tools/generate-wire.py \
44 tools/update-mocks.sh \
45 tools/mockup.sh \
46 devtools/sql-rewrite.py
47+ '' else ''
48+ substituteInPlace external/libwally-core/tools/autogen.sh --replace gsed sed && \
49+ substituteInPlace external/libwally-core/configure.ac --replace gsed sed
50 '';
5152 configureFlags = [ "--disable-developer" "--disable-valgrind" ];
···66 homepage = "https://github.com/ElementsProject/lightning";
67 maintainers = with maintainers; [ jb55 prusnak ];
68 license = licenses.mit;
69+ platforms = platforms.linux ++ platforms.darwin;
70 };
71}