add curated clightning plugins
This commit is contained in:
parent
4640821f96
commit
1d44b99340
14 changed files with 295 additions and 3 deletions
63
pkgs/clightning-plugins/default.nix
Normal file
63
pkgs/clightning-plugins/default.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
pkgs: nbPython3Packages:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "lightningd";
|
||||
repo = "plugins";
|
||||
rev = "6cd472636926f05a9c472139fabe1ff11c90aa6a";
|
||||
sha256 = "1lisx85vzsfzjhdc6zdz0l6bcrdgg6rp5xbc5jmx93mv8qqg2cns";
|
||||
};
|
||||
|
||||
version = builtins.substring 0 7 src.rev;
|
||||
|
||||
plugins = with nbPython3Packages; {
|
||||
helpme = {};
|
||||
monitor = {};
|
||||
prometheus = {
|
||||
extraPkgs = [ prometheus_client ];
|
||||
patchRequirements = "--replace prometheus-client==0.6.0 prometheus-client==0.8.0";
|
||||
};
|
||||
rebalance = {};
|
||||
summary = {
|
||||
extraPkgs = [ packaging requests ];
|
||||
};
|
||||
zmq = {
|
||||
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}";
|
||||
};
|
||||
in drv;
|
||||
|
||||
in
|
||||
builtins.mapAttrs mkPlugin plugins
|
||||
Loading…
Add table
Add a link
Reference in a new issue