411b131c3a test: remove clightning plugin start timeout patch (Erik Arvstedt)
815f2cd325 clightning: don't set `datadir` for `bitcoin-cli` plugin (Erik Arvstedt)
04b6a09be4 clightning-plugins: use `clnrest`, remove Python version (Erik Arvstedt)
ac86e67c85 clnrest: init at 0.2.0 (Erik Arvstedt)
6e3c5db5f5 update nixpkgs (Jonas Nick)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK 411b131c3a

Tree-SHA512: 8dd521079d76b75d4db5cbb94d622fe4713b52cf2ffe196d997838c918ba0d07622e5ae5789851c38520dcbd00f24c4657d04a82b21342adb0bb52eca609664d
This commit is contained in:
Jonas Nick 2025-05-09 13:57:05 +00:00
commit b2bc5e6e75
No known key found for this signature in database
GPG key ID: 4861DBF262123605
10 changed files with 66 additions and 97 deletions

12
flake.lock generated
View file

@ -44,11 +44,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1742937945,
"narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=",
"lastModified": 1746422338,
"narHash": "sha256-NTtKOTLQv6dPfRe00OGSywg37A1FYqldS6xiNmqBUYc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7",
"rev": "5b35d248e9206c1f3baf8de6a7683fee126364aa",
"type": "github"
},
"original": {
@ -60,11 +60,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1742923925,
"narHash": "sha256-biPjLws6FiBVUUDHEMFq5pUQL84Wf7PntPYdo3oKkFw=",
"lastModified": 1746332716,
"narHash": "sha256-VBmKSkmw9PYBCEGhBKzORjx+nwNZkPZyHcUHE21A/ws=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "25d1b84f5c90632a623c48d83a2faf156451e6b1",
"rev": "6b1c028bce9c89e9824cde040d6986d428296055",
"type": "github"
},
"original": {

View file

@ -37,8 +37,8 @@ let
};
package = mkOption {
type = types.package;
default = config.nix-bitcoin.pkgs.nbPython3Packages.clnrest;
defaultText = "config.nix-bitcoin.pkgs.nbPython3Packages.clnrest";
default = config.nix-bitcoin.pkgs.clnrest;
defaultText = "config.nix-bitcoin.pkgs.clnrest";
description = "The package providing clnrest binaries.";
};
};

View file

@ -116,13 +116,7 @@ let
network = bitcoind.makeNetworkName "bitcoin" "regtest";
configFile = pkgs.writeText "config" ''
network=${network}
${
if cfg.useBcliPlugin then ''
bitcoin-datadir=${config.services.bitcoind.dataDir}
'' else ''
disable-plugin=bcli
''
}
${optionalString (!cfg.useBcliPlugin) "disable-plugin=bcli"}
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
always-use-proxy=${boolToString cfg.always-use-proxy}
bind-addr=${cfg.address}:${toString cfg.port}

43
pkgs/clnrest/default.nix Normal file
View file

@ -0,0 +1,43 @@
{
lib,
rustPlatform,
clightning,
unzip,
protobuf,
}:
rustPlatform.buildRustPackage rec {
pname = "clnrest";
version = "0.2.0";
inherit (clightning) src;
cargoHash = "sha256-rXOpRNzIDohfvn3n1xEhc/C1pCpzgfFXHjob7/qOeXM=";
depsExtraArgs = {
nativeBuildInputs = [ unzip ];
# Don't run `configure` of the main project build
dontConfigure = true;
};
nativeBuildInputs = [
# For unpacking the src
unzip
];
cargoBuildFlags = [ "--package clnrest" ];
nativeCheckInputs = [
# Required by lightning/cln-grpc/build.rs
protobuf
];
meta = with lib; {
description = "REST plugin for clightning";
homepage = "https://github.com/ElementsProject/lightning/tree/master/plugins/rest-plugin";
license = licenses.mit;
maintainers = with maintainers; [
erikarvstedt
];
mainProgram = "clnrest";
};
}

View file

@ -12,6 +12,7 @@ in
let self = {
clightning-rest = pkgs.callPackage ./clightning-rest { inherit (self) fetchNodeModules; };
clightning-plugins = pkgs.recurseIntoAttrs (import ./clightning-plugins pkgs self.nbPython3Packages);
clnrest = pkgs.callPackage ./clnrest { inherit (self.pinned) clightning; };
joinmarket = pkgs.callPackage ./joinmarket { inherit (self) nbPython3PackagesJoinmarket; };
lndinit = pkgs.callPackage ./lndinit { };
liquid-swap = pkgs.python3Packages.callPackage ./liquid-swap { };

View file

@ -3,7 +3,7 @@ pkgs: pkgsUnstable:
{
inherit (pkgs)
charge-lnd
fulcrum
extra-container
hwi
lightning-loop
lightning-pool
@ -17,7 +17,7 @@ pkgs: pkgsUnstable:
clightning
electrs
elementsd
extra-container
fulcrum
lnd
nbxplorer;

View file

@ -1,59 +0,0 @@
{ buildPythonPackage
, clightning
, python
, poetry-core
, flask
, flask-cors
, flask-restx
, flask-socketio
, gevent
, gevent-websocket
, gunicorn
, pyln-client
, json5
, jsonschema
}:
let
self = buildPythonPackage rec {
pname = "clnrest";
version = clightning.version;
format = "pyproject";
inherit (clightning) src;
postUnpack = "sourceRoot=$sourceRoot/plugins/clnrest";
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'gevent = "^23.9.0.post1"' 'gevent = "24.2.1"' \
--replace-fail 'gunicorn = "^21.2.0"' 'gunicorn = "23.0.0"' \
--replace-fail 'flask = "^2.3.3"' 'flask = "3.0.3"'
# Add extra required src files that are missing in pyproject.toml
sed -i '/authors/a include = [ { path = "utilities", format = ["sdist", "wheel"] } ]' pyproject.toml
'';
nativeBuildInputs = [ poetry-core ];
# From https://github.com/ElementsProject/lightning/blob/master/plugins/clnrest/pyproject.toml
propagatedBuildInputs = [
flask
flask-cors
flask-restx
flask-socketio
gevent
gevent-websocket
gunicorn
json5
pyln-client
];
postInstall = ''
makeWrapper ${python}/bin/python $out/bin/clnrest \
--set NIX_PYTHONPATH ${python.pkgs.makePythonPath self.propagatedBuildInputs} \
--add-flags "$out/lib/${python.libPrefix}/site-packages/clnrest.py"
'';
};
in
self

View file

@ -10,7 +10,8 @@ rec {
pyln-proto = clightningPkg ./pyln-proto;
pyln-bolt7 = clightningPkg ./pyln-bolt7;
pylightning = clightningPkg ./pylightning;
clnrest = clightningPkg ./clnrest;
# TODO: Remove after 2026-05-09
clnrest = throw "`nbPython3Packages.clnrest` has been replaced with nix-bitcoin pkg `clnrest` (Rust rewrite)";
# Packages only used by joinmarket
bencoderpyx = callPackage ./bencoderpyx {};

View file

@ -21,11 +21,11 @@
"nixos-infra": {
"flake": false,
"locked": {
"lastModified": 1741456091,
"narHash": "sha256-l7T5FJyQZz2cRnLrKQGl17Tdk8qHhYJHiwLmSGnGTb4=",
"lastModified": 1746309510,
"narHash": "sha256-zp+318bDhi4/3rLk6uv8hWxQAbutoYMXk5B4Wzws02g=",
"owner": "NixOS",
"repo": "infra",
"rev": "c6f24c9bf8fc7a15828f196ff141fd8a72c41716",
"rev": "59f6670f2ef35c66c78c05edd487eeb701d2f5f4",
"type": "github"
},
"original": {
@ -43,11 +43,11 @@
"npmlock2nix": "npmlock2nix"
},
"locked": {
"lastModified": 1741681923,
"narHash": "sha256-x08XAFJmmLO4AveUO7tgKNdDXIVv3vHi09D7Eh3jAbM=",
"lastModified": 1746437871,
"narHash": "sha256-/nEYTmlqRS8JNGZqFJiUndUI4541jpz30tAYDX9RPRA=",
"owner": "nixos",
"repo": "nixos-search",
"rev": "753861364543ae8949fcce0c43fdd0c3e3b5b9d1",
"rev": "b270e843f087f65c3d079953de15d53d7fb7aaa9",
"type": "github"
},
"original": {
@ -58,11 +58,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1741379970,
"narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=",
"lastModified": 1746232882,
"narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "36fd87baa9083f34f7f5027900b62ee6d09b1f2f",
"rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008",
"type": "github"
},
"original": {

View file

@ -271,17 +271,6 @@ let
scenarios.secureNode
../modules/presets/hardened-extended.nix
];
# Patch clightning to increase the plugin init timeout.
# Otherwise this test can fail on slower hardware.
nix-bitcoin.pkgOverlays = super: self: {
clightning = super.clightning.overrideAttrs (old: {
postPatch = old.postPatch + ''
substituteInPlace lightningd/plugin.c \
--replace-fail "#define PLUGIN_MANIFEST_TIMEOUT 60" "#define PLUGIN_MANIFEST_TIMEOUT 200"
'';
});
};
};
netnsBase = { config, pkgs, ... }: {