From 6e3c5db5f513e9ac674a013c3c2d03a155cb5bbf Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Mon, 5 May 2025 12:40:09 +0000 Subject: [PATCH 1/5] update nixpkgs bitcoin: 28.1 -> 29.0 bitcoind: 28.1 -> 29.0 btcpayserver: 2.0.7 -> 2.1.0 clightning: 24.11.1 -> 25.02.1 fulcrum: 1.11.1 -> 1.12.0.1 nbxplorer: 2.5.23 -> 2.5.25 --- flake.lock | 12 ++++++------ pkgs/pinned.nix | 4 ++-- test/nixos-search/flake.lock | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index 321d8c6..425906b 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/pkgs/pinned.nix b/pkgs/pinned.nix index 831c429..60b9eaa 100644 --- a/pkgs/pinned.nix +++ b/pkgs/pinned.nix @@ -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; diff --git a/test/nixos-search/flake.lock b/test/nixos-search/flake.lock index d5e5a87..2587d3c 100644 --- a/test/nixos-search/flake.lock +++ b/test/nixos-search/flake.lock @@ -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": { From ac86e67c85e0cde22bb2c0dfd963f23ff9fbe76c Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 8 May 2025 23:58:27 +0200 Subject: [PATCH 2/5] clnrest: init at 0.2.0 --- pkgs/clnrest/default.nix | 43 ++++++++++++++++++++++++++++++++++++++++ pkgs/default.nix | 1 + 2 files changed, 44 insertions(+) create mode 100644 pkgs/clnrest/default.nix diff --git a/pkgs/clnrest/default.nix b/pkgs/clnrest/default.nix new file mode 100644 index 0000000..e5e9c7b --- /dev/null +++ b/pkgs/clnrest/default.nix @@ -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"; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 66b92ad..5fc1ccf 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -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 { }; From 04b6a09be4f1974bd8eb05bb118be8b2c0d05eff Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 9 May 2025 13:31:18 +0200 Subject: [PATCH 3/5] clightning-plugins: use `clnrest`, remove Python version --- modules/clightning-plugins/clnrest.nix | 4 +- pkgs/python-packages/clnrest/default.nix | 59 ------------------------ pkgs/python-packages/default.nix | 3 +- 3 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 pkgs/python-packages/clnrest/default.nix diff --git a/modules/clightning-plugins/clnrest.nix b/modules/clightning-plugins/clnrest.nix index a5a39ee..d073700 100644 --- a/modules/clightning-plugins/clnrest.nix +++ b/modules/clightning-plugins/clnrest.nix @@ -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."; }; }; diff --git a/pkgs/python-packages/clnrest/default.nix b/pkgs/python-packages/clnrest/default.nix deleted file mode 100644 index 9a45c04..0000000 --- a/pkgs/python-packages/clnrest/default.nix +++ /dev/null @@ -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 diff --git a/pkgs/python-packages/default.nix b/pkgs/python-packages/default.nix index 7445beb..ca6a33c 100644 --- a/pkgs/python-packages/default.nix +++ b/pkgs/python-packages/default.nix @@ -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 {}; From 815f2cd325ef2abebb596de1ac453014d5cb4ff6 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 9 May 2025 13:31:19 +0200 Subject: [PATCH 4/5] clightning: don't set `datadir` for `bitcoin-cli` plugin This option is unneeded because `bitcoin-cli` auth and connection settings are already provided by other options like `bitcoin-rpcpassword`. In bitcoind versions prior to 29.0, option `datadir` (passed by clightning to `bitcoin-cli`) was therefore ignored. Since 29.0, option `datadir` is always checked for validity. This causes a file permission error because service clighting has no access to the bitcoin datadir. This is now fixed. --- modules/clightning.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/clightning.nix b/modules/clightning.nix index 766e2ce..b8fd064 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -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} From 411b131c3a125fa6f64b6e0068396c0847bacbc6 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 9 May 2025 13:31:20 +0200 Subject: [PATCH 5/5] test: remove clightning plugin start timeout patch Unneded because the timeout has been increased upstream: https://github.com/ElementsProject/lightning/commit/ee3133f19885269985180bd20e0b9737c70cf86c --- test/tests.nix | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/tests.nix b/test/tests.nix index 89a1595..4565059 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -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, ... }: {