2020-11-18 18:01:45 -08:00
|
|
|
pkgs: nbPython3Packages:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "lightningd";
|
|
|
|
repo = "plugins";
|
2022-05-22 06:56:14 -07:00
|
|
|
rev = "7ef9e6c172c0bd0dd09168e19b29e44f7ec6ec4d";
|
|
|
|
sha256 = "12llf4dnyria0s1x4bmm360d6bxk47z0wyxwwlmq3762mdfl36js";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
version = builtins.substring 0 7 src.rev;
|
|
|
|
|
|
|
|
plugins = with nbPython3Packages; {
|
2022-07-14 14:45:28 -07:00
|
|
|
commando = {
|
|
|
|
description = "Enable RPC over lightning";
|
|
|
|
extraPkgs = [ nbPython3Packages.runes ];
|
|
|
|
};
|
|
|
|
feeadjuster = {
|
|
|
|
description = "Dynamically changes channel fees to keep your channels more balanced";
|
|
|
|
};
|
|
|
|
helpme = {
|
|
|
|
description = "Walks you through setting up a c-lightning node, offering advice for common problems";
|
|
|
|
};
|
2022-05-05 11:43:10 -07:00
|
|
|
monitor = {
|
|
|
|
description = "Helps you analyze the health of your peers and channels";
|
|
|
|
extraPkgs = [ packaging ];
|
|
|
|
};
|
2020-11-18 18:01:45 -08:00
|
|
|
prometheus = {
|
2021-12-14 10:51:23 -08:00
|
|
|
description = "Lightning node exporter for the prometheus timeseries server";
|
2020-11-18 18:01:45 -08:00
|
|
|
extraPkgs = [ prometheus_client ];
|
2021-08-14 10:57:49 -07:00
|
|
|
patchRequirements =
|
2022-06-13 00:08:08 -07:00
|
|
|
"--replace prometheus-client==0.6.0 prometheus-client==0.13.1"
|
2021-08-14 10:57:49 -07:00
|
|
|
+ " --replace pyln-client~=0.9.3 pyln-client~=0.10.1";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
2022-07-14 14:45:28 -07:00
|
|
|
rebalance = {
|
|
|
|
description = "Keeps your channels balanced";
|
2022-02-20 19:44:14 -08:00
|
|
|
};
|
2020-11-18 18:01:45 -08:00
|
|
|
summary = {
|
2021-12-14 10:51:23 -08:00
|
|
|
description = "Prints a summary of the node status";
|
2020-11-18 18:01:45 -08:00
|
|
|
extraPkgs = [ packaging requests ];
|
|
|
|
};
|
|
|
|
zmq = {
|
2021-12-14 10:51:23 -08:00
|
|
|
description = "Publishes notifications via ZeroMQ to configured endpoints";
|
2020-11-18 18:01:45 -08:00
|
|
|
scriptName = "cl-zmq";
|
|
|
|
extraPkgs = [ twisted txzmq ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
basePkgs = [ nbPython3Packages.pyln-client ];
|
|
|
|
|
|
|
|
mkPlugin = name: plugin: let
|
|
|
|
python = pkgs.python3.withPackages (_: basePkgs ++ (plugin.extraPkgs or []));
|
|
|
|
script = "${plugin.scriptName or name}.py";
|
|
|
|
drv = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "clightning-plugin-${name}";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
buildInputs = [ python ];
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
cp --no-preserve=mode -r ${src}/${name} $out
|
|
|
|
cd $out
|
|
|
|
${lib.optionalString (plugin ? patchRequirements) ''
|
|
|
|
substituteInPlace requirements.txt ${plugin.patchRequirements}
|
|
|
|
''}
|
|
|
|
|
|
|
|
# Check that requirements are met
|
|
|
|
PYTHONPATH=${toString python}/${python.sitePackages} \
|
|
|
|
${pkgs.python3Packages.pip}/bin/pip install -r requirements.txt --no-cache --no-index
|
|
|
|
|
|
|
|
chmod +x ${script}
|
|
|
|
patchShebangs ${script}
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.path = "${drv}/${script}";
|
2021-12-14 10:51:23 -08:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
inherit (plugin) description;
|
|
|
|
homepage = "https://github.com/lightningd/plugins";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ nixbitcoin earvstedt ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
in drv;
|
|
|
|
|
|
|
|
in
|
|
|
|
builtins.mapAttrs mkPlugin plugins
|