2020-11-19 02:01:45 +00:00
|
|
|
pkgs: nbPython3Packages:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
2023-06-09 12:40:32 +00:00
|
|
|
src = pkgs.applyPatches {
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "lightningd";
|
|
|
|
repo = "plugins";
|
|
|
|
rev = "eee5e90df442586b7f891df4fc0c67d273534737";
|
|
|
|
sha256 = "0ry6gxp9gqpzpdjykx0a5q53saai5jydwvcy6smsh0f5dmjl8srh";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# https://github.com/lightningd/plugins/pull/451
|
|
|
|
(pkgs.fetchpatch {
|
|
|
|
name = "202305-prometheus-msat-purge";
|
|
|
|
url = "https://github.com/lightningd/plugins/commit/f8a27b97a1b9ded8790c1f033b1f4268c0a6e210.patch";
|
|
|
|
sha256 = "sha256-0lFMhHHIi9bUU0+xaHhpnascNlFmr51JxE6e2F0s0zc=";
|
|
|
|
})
|
|
|
|
];
|
2020-11-19 02:01:45 +00:00
|
|
|
};
|
|
|
|
|
2023-06-09 12:40:32 +00:00
|
|
|
version = builtins.substring 0 7 src.src.rev;
|
2020-11-19 02:01:45 +00:00
|
|
|
|
|
|
|
plugins = with nbPython3Packages; {
|
2022-07-26 00:08:01 +00:00
|
|
|
currencyrate = {
|
|
|
|
description = "Currency rate fetcher and converter";
|
|
|
|
extraPkgs = [ requests cachetools ];
|
|
|
|
};
|
2022-07-14 21:45:28 +00:00
|
|
|
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 18:43:10 +00:00
|
|
|
monitor = {
|
|
|
|
description = "Helps you analyze the health of your peers and channels";
|
|
|
|
extraPkgs = [ packaging ];
|
|
|
|
};
|
2020-11-19 02:01:45 +00:00
|
|
|
prometheus = {
|
2021-12-14 18:51:23 +00:00
|
|
|
description = "Lightning node exporter for the prometheus timeseries server";
|
2020-11-19 02:01:45 +00:00
|
|
|
extraPkgs = [ prometheus_client ];
|
2021-08-14 17:57:49 +00:00
|
|
|
patchRequirements =
|
2022-12-18 18:40:19 +00:00
|
|
|
"--replace prometheus-client==0.6.0 prometheus-client==0.15.0"
|
2023-03-07 21:08:35 +00:00
|
|
|
+ " --replace pyln-client~=0.9.3 pyln-client~=23.02";
|
2020-11-19 02:01:45 +00:00
|
|
|
};
|
2022-07-14 21:45:28 +00:00
|
|
|
rebalance = {
|
|
|
|
description = "Keeps your channels balanced";
|
2022-02-21 03:44:14 +00:00
|
|
|
};
|
2020-11-19 02:01:45 +00:00
|
|
|
summary = {
|
2021-12-14 18:51:23 +00:00
|
|
|
description = "Prints a summary of the node status";
|
2020-11-19 02:01:45 +00:00
|
|
|
extraPkgs = [ packaging requests ];
|
|
|
|
};
|
|
|
|
zmq = {
|
2021-12-14 18:51:23 +00:00
|
|
|
description = "Publishes notifications via ZeroMQ to configured endpoints";
|
2020-11-19 02:01:45 +00: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 = ''
|
2022-08-25 19:00:00 +00:00
|
|
|
cp --no-preserve=mode -r '${src}/${name}' "$out"
|
|
|
|
cd "$out"
|
2020-11-19 02:01:45 +00:00
|
|
|
${lib.optionalString (plugin ? patchRequirements) ''
|
|
|
|
substituteInPlace requirements.txt ${plugin.patchRequirements}
|
|
|
|
''}
|
|
|
|
|
|
|
|
# Check that requirements are met
|
2022-08-25 19:00:00 +00:00
|
|
|
PYTHONPATH='${toString python}/${python.sitePackages}' \
|
2020-11-19 02:01:45 +00:00
|
|
|
${pkgs.python3Packages.pip}/bin/pip install -r requirements.txt --no-cache --no-index
|
|
|
|
|
2022-08-25 19:00:00 +00:00
|
|
|
chmod +x '${script}'
|
|
|
|
patchShebangs '${script}'
|
2020-11-19 02:01:45 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.path = "${drv}/${script}";
|
2021-12-14 18:51:23 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
inherit (plugin) description;
|
|
|
|
homepage = "https://github.com/lightningd/plugins";
|
|
|
|
license = licenses.bsd3;
|
2022-12-18 12:13:46 +00:00
|
|
|
maintainers = with maintainers; [ nixbitcoin erikarvstedt ];
|
2021-12-14 18:51:23 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2020-11-19 02:01:45 +00:00
|
|
|
};
|
|
|
|
in drv;
|
|
|
|
|
|
|
|
in
|
|
|
|
builtins.mapAttrs mkPlugin plugins
|