From b57e7466fb1aa15ee29d287046edc1c26b28d65d Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 3 Sep 2022 15:32:15 +0000 Subject: [PATCH 1/7] update nixpkgs btcpayserver: 1.6.9 -> 1.6.10 lnd: 0.15.0-beta -> 0.15.1-beta --- flake.lock | 12 ++++++------ test/nixos-search/flake.lock | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index a424b6d..a49410e 100644 --- a/flake.lock +++ b/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1661009065, - "narHash": "sha256-i+Q2ttGp4uOL3j0wEYP3MXLcu/4L/WbChxGQogiNSZo=", + "lastModified": 1662099760, + "narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9a91318fffec81ad009b73fd3b640d2541d87909", + "rev": "67e45078141102f45eff1589a831aeaa3182b41e", "type": "github" }, "original": { @@ -33,11 +33,11 @@ }, "nixpkgsUnstable": { "locked": { - "lastModified": 1661008273, - "narHash": "sha256-UpDqsGzUswIHG7FwzeIewjWlElF17UVLNbI2pwlbcBY=", + "lastModified": 1662096612, + "narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0cc6444e74cd21e8da8d81ef4cd778492e10f843", + "rev": "21de2b973f9fee595a7a1ac4693efff791245c34", "type": "github" }, "original": { diff --git a/test/nixos-search/flake.lock b/test/nixos-search/flake.lock index 6f89d94..c754e21 100644 --- a/test/nixos-search/flake.lock +++ b/test/nixos-search/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1656928814, - "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -18,11 +18,11 @@ "nixos-org-configurations": { "flake": false, "locked": { - "lastModified": 1659104385, - "narHash": "sha256-Z8tAe2w0CEDabxO4LDleRhPzz0tDpRjKGIUbH62khyo=", + "lastModified": 1660725019, + "narHash": "sha256-729dr5TzCG3JIYgrcyyZQoG/e+Ugr6r2NB08Izer0q8=", "owner": "NixOS", "repo": "nixos-org-configurations", - "rev": "f467c27834fddeb1ffe156c54b637db240bc7273", + "rev": "569797100aac69780a12542c2143bb741380d4ec", "type": "github" }, "original": { @@ -38,11 +38,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1660820431, - "narHash": "sha256-HeyLhcWs+ItFxGZiXbUlYbJ7y7sW1gBqyYqnToxGmN0=", + "lastModified": 1661847188, + "narHash": "sha256-GSA60qVevqN2Q+bbD4O6nbWUCzNtjbEQhYBvcSSRIkI=", "owner": "nixos", "repo": "nixos-search", - "rev": "087925bbb24ab717a8033817be64b52fba312619", + "rev": "7d1c1046ba918625fef44a204c219188824f46fb", "type": "github" }, "original": { @@ -53,11 +53,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659713809, - "narHash": "sha256-M4aHuXXVnfprM8xPH2lLkYkkR0fmaG5QmvIc0DT/d4E=", + "lastModified": 1661450036, + "narHash": "sha256-0/9UyJLtfWqF4uvOrjFIzk8ue1YYUHa6JIhV0mALkH0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "93c57a988470c1948976b1bb70abbd5855c5b810", + "rev": "f3d0897be466aa09a37f6bf59e62c360c3f9a6cc", "type": "github" }, "original": { From 9c766df16a0e58e25fa5ced1d4c05f7fae19425e Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 3 Sep 2022 15:33:44 +0000 Subject: [PATCH 2/7] Revert "clightning: fix build" This reverts commit 321e8ba06efd05605ff13fe9087f099b5b4ec8dc which is not necessary anymore due to the nixpkgs update. --- .../clightning-mistune-workaround/default.nix | 12 --------- .../clightning-mistune-workaround/mistune.nix | 27 ------------------- pkgs/default.nix | 8 ------ pkgs/pinned.nix | 1 + pkgs/python-packages/default.nix | 2 +- 5 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 pkgs/clightning-mistune-workaround/default.nix delete mode 100644 pkgs/clightning-mistune-workaround/mistune.nix diff --git a/pkgs/clightning-mistune-workaround/default.nix b/pkgs/clightning-mistune-workaround/default.nix deleted file mode 100644 index 5fd55d9..0000000 --- a/pkgs/clightning-mistune-workaround/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ clightning, python3 }: - -clightning.override { - python3 = python3.override { - packageOverrides = self: super: { - mistune = self.callPackage ./mistune.nix { - version = "0.8.4"; - sha256 = "59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e"; - }; - }; - }; -} diff --git a/pkgs/clightning-mistune-workaround/mistune.nix b/pkgs/clightning-mistune-workaround/mistune.nix deleted file mode 100644 index 2450837..0000000 --- a/pkgs/clightning-mistune-workaround/mistune.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, nose -, version -, sha256 -, format ? "setuptools" -, extraMeta ? {} -}: - -buildPythonPackage rec { - inherit version format; - pname = "mistune"; - - src = fetchPypi { - inherit pname version sha256; - }; - - buildInputs = [ nose ]; - pythonImportsCheck = [ "mistune" ]; - - meta = with lib; { - description = "The fastest markdown parser in pure Python"; - homepage = "https://github.com/lepture/mistune"; - license = licenses.bsd3; - } // extraMeta; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index cc5fb42..21ede79 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -27,14 +27,6 @@ let self = { fetchNodeModules = pkgs.callPackage ./build-support/fetch-node-modules.nix { }; - # Fix clightning build by using python package mistune 0.8.4, which is a - # strict requirement. This version is affected by CVE-2022-34749, but this - # is irrelevant in this context. - # - # TODO-EXTERNAL: - # Remove this when the clightning build is fixed upstream. - clightning = pkgs.callPackage ./clightning-mistune-workaround { inherit (pkgs) clightning; }; - # Internal pkgs netns-exec = pkgs.callPackage ./netns-exec { }; krops = import ./krops { inherit pkgs; }; diff --git a/pkgs/pinned.nix b/pkgs/pinned.nix index 91629b3..e61c9b4 100644 --- a/pkgs/pinned.nix +++ b/pkgs/pinned.nix @@ -14,6 +14,7 @@ pkgs: pkgsUnstable: inherit (pkgsUnstable) btcpayserver charge-lnd + clightning fulcrum hwi lightning-loop diff --git a/pkgs/python-packages/default.nix b/pkgs/python-packages/default.nix index 3d4f84f..cd2c593 100644 --- a/pkgs/python-packages/default.nix +++ b/pkgs/python-packages/default.nix @@ -3,7 +3,7 @@ let inherit (self) callPackage; joinmarketPkg = pkg: callPackage pkg { inherit (nbPkgs.joinmarket) version src; }; - clightningPkg = pkg: callPackage pkg { inherit (nbPkgs) clightning; }; + clightningPkg = pkg: callPackage pkg { inherit (nbPkgs.pinned) clightning; }; unstable = (import ../nixpkgs-pinned.nix).nixpkgs-unstable; in { From 33144262ecb263d4ce002ac61a531f4a6d524d67 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 3 Sep 2022 21:19:35 +0000 Subject: [PATCH 3/7] clightning-plugins: bump ver of pyln-client required by prometheus --- pkgs/clightning-plugins/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/clightning-plugins/default.nix b/pkgs/clightning-plugins/default.nix index c7c41e0..b87c3d5 100644 --- a/pkgs/clightning-plugins/default.nix +++ b/pkgs/clightning-plugins/default.nix @@ -36,7 +36,7 @@ let extraPkgs = [ prometheus_client ]; patchRequirements = "--replace prometheus-client==0.6.0 prometheus-client==0.13.1" - + " --replace pyln-client~=0.9.3 pyln-client~=0.10.1"; + + " --replace pyln-client~=0.9.3 pyln-client~=0.11.1"; }; rebalance = { description = "Keeps your channels balanced"; From 623c238b16bde9fcb5f6ef7d4f98036b37bd38e9 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 3 Sep 2022 21:15:50 +0000 Subject: [PATCH 4/7] clightning-plugins: remove commando pkg and module clightning 0.12.0 ships with a reimplementation of the commando plugin that is incompatible with the commando module that existed in nix-bitcoin. --- README.md | 1 - modules/clightning-plugins/commando.nix | 37 ------------------------- modules/clightning-plugins/default.nix | 1 - modules/obsolete-options.nix | 15 ++++++++++ pkgs/clightning-plugins/default.nix | 4 --- test/tests.nix | 9 ++---- 6 files changed, 18 insertions(+), 49 deletions(-) delete mode 100644 modules/clightning-plugins/commando.nix diff --git a/README.md b/README.md index 320fc2d..a282146 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,6 @@ NixOS modules ([src](modules/modules.nix)) and [database replication](docs/services.md#setup-clightning-database-replication).\ Available plugins: * [clboss](https://github.com/ZmnSCPxj/clboss): automated C-Lightning Node Manager - * [commando](https://github.com/lightningd/plugins/tree/master/commando): control your node over lightning * [currencyrate](https://github.com/lightningd/plugins/tree/master/currencyrate): currency converter * [helpme](https://github.com/lightningd/plugins/tree/master/helpme): walks you through setting up a fresh c-lightning node * [monitor](https://github.com/lightningd/plugins/tree/master/monitor): helps you analyze the health of your peers and channels diff --git a/modules/clightning-plugins/commando.nix b/modules/clightning-plugins/commando.nix deleted file mode 100644 index b9c19f4..0000000 --- a/modules/clightning-plugins/commando.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let cfg = config.services.clightning.plugins.commando; in -{ - options.services.clightning.plugins.commando = { - enable = mkEnableOption "commando (clightning plugin)"; - readers = mkOption { - type = with types; listOf str; - default = []; - example = [ "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518" ]; - description = '' - IDs of nodes which can execute read-only commands (list*, get*, ...). - ''; - }; - writers = mkOption { - type = with types; listOf str; - default = []; - example = [ "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518" ]; - description = '' - IDs of nodes which can execute any commands. - ''; - }; - }; - - config = mkIf cfg.enable { - services.clightning.extraConfig = '' - plugin=${config.nix-bitcoin.pkgs.clightning-plugins.commando.path} - '' - + concatMapStrings (reader: '' - commando_reader=${reader} - '') cfg.readers - + concatMapStrings (writer: '' - commando_writer=${writer} - '') cfg.writers; - }; -} diff --git a/modules/clightning-plugins/default.nix b/modules/clightning-plugins/default.nix index b31352a..8669860 100644 --- a/modules/clightning-plugins/default.nix +++ b/modules/clightning-plugins/default.nix @@ -14,7 +14,6 @@ let in { imports = [ ./clboss.nix - ./commando.nix ./feeadjuster.nix ./prometheus.nix ./summary.nix diff --git a/modules/obsolete-options.nix b/modules/obsolete-options.nix index e07bf30..1465963 100644 --- a/modules/obsolete-options.nix +++ b/modules/obsolete-options.nix @@ -61,6 +61,21 @@ in { "btcpayserver" "rtl" "electrs" + ]) ++ + # 0.0.77 + ( + let + optionName = [ "services" "clightning" "plugins" "commando" ]; + in [ + (mkRemovedOptionModule (optionName ++ [ "enable" ]) '' + clightning 0.12.0 ships with a reimplementation of the commando plugin + that is incompatible with the commando module that existed in + nix-bitcoin. The new built-in commando plugin is always enabled. For + information on how to use it, run `lightning-cli help commando` and + `lightning-cli help commando-rune`. + '') + (mkRemovedOptionModule (optionName ++ [ "readers" ]) "") + (mkRemovedOptionModule (optionName ++ [ "writers" ]) "") ]); config = { diff --git a/pkgs/clightning-plugins/default.nix b/pkgs/clightning-plugins/default.nix index b87c3d5..46d8022 100644 --- a/pkgs/clightning-plugins/default.nix +++ b/pkgs/clightning-plugins/default.nix @@ -13,10 +13,6 @@ let version = builtins.substring 0 7 src.rev; plugins = with nbPython3Packages; { - commando = { - description = "Enable RPC over lightning"; - extraPkgs = [ nbPython3Packages.runes ]; - }; currencyrate = { description = "Currency rate fetcher and converter"; extraPkgs = [ requests cachetools ]; diff --git a/test/tests.nix b/test/tests.nix index 1d74b40..77129ba 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -56,7 +56,9 @@ let services.clightning.extraConfig = mkIf config.test.noConnections "disable-dns"; test.data.clightning-plugins = let plugins = config.services.clightning.plugins; - enabled = builtins.filter (plugin: plugins.${plugin}.enable) (builtins.attrNames plugins); + removed = [ "commando" ]; + enabled = builtins.filter (plugin: plugins.${plugin}.enable) + (subtractLists removed (builtins.attrNames plugins)); nbPkgs = config.nix-bitcoin.pkgs; pluginPkgs = nbPkgs.clightning-plugins // { clboss.path = "${nbPkgs.clboss}/bin/clboss"; @@ -158,11 +160,6 @@ let prometheus.enable = true; rebalance.enable = true; summary.enable = true; - commando = { - enable = true; - readers = [ "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518" ]; - writers = [ "0336efaa22b8ba77ae721a25d589e1c5f2486073dd2f041add32a23316150e8b62" ]; - }; zmq = let tcpEndpoint = "tcp://127.0.0.1:5501"; in { enable = true; channel-opened = tcpEndpoint; From c165836fd18a18f4b513a04d954f6ab4779208e4 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 3 Sep 2022 21:17:16 +0000 Subject: [PATCH 5/7] bitcoind: add "getdeploymentinfo" to public rpc whitelist This is required by lnd 0.15.1. --- modules/bitcoind-rpc-public-whitelist.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/bitcoind-rpc-public-whitelist.nix b/modules/bitcoind-rpc-public-whitelist.nix index cbc8f3d..ca2fc8b 100644 --- a/modules/bitcoind-rpc-public-whitelist.nix +++ b/modules/bitcoind-rpc-public-whitelist.nix @@ -16,6 +16,7 @@ "getblockstats" "getchaintips" "getchaintxstats" + "getdeploymentinfo" "getdifficulty" "getmempoolancestors" "getmempooldescendants" From 5255c7e8bc7f17d3b0bb0524350432a9c27dc8dc Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Tue, 6 Sep 2022 11:45:39 +0000 Subject: [PATCH 6/7] pyln-client: remove pkg patch that has become unnecessary --- pkgs/python-packages/pyln-client/default.nix | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pkgs/python-packages/pyln-client/default.nix b/pkgs/python-packages/pyln-client/default.nix index b997ce4..99e1a2c 100644 --- a/pkgs/python-packages/pyln-client/default.nix +++ b/pkgs/python-packages/pyln-client/default.nix @@ -17,11 +17,4 @@ buildPythonPackage rec { checkInputs = [ pytestCheckHook ]; postUnpack = "sourceRoot=$sourceRoot/contrib/${pname}"; - - # Fix version typo in pyproject.toml - # TODO-EXTERNAL: - # This is already fixed upstream. Remove this after the next clightning release. - postPatch = '' - sed -i 's|pyln-bolt7 = "^1.0.186"|pyln-bolt7 = "^1.0.2.186"|' pyproject.toml - ''; } From 63f8b740268792d10475bdc8d203f50fa1641583 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Tue, 6 Sep 2022 11:43:46 +0000 Subject: [PATCH 7/7] pyln-client: add patch that fixes plugins Without this patch, the summary and feeadjuster plugins crash on startup. --- pkgs/python-packages/pyln-client/default.nix | 8 ++++++++ pkgs/python-packages/pyln-client/msat-null.patch | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/python-packages/pyln-client/msat-null.patch diff --git a/pkgs/python-packages/pyln-client/default.nix b/pkgs/python-packages/pyln-client/default.nix index 99e1a2c..afc7798 100644 --- a/pkgs/python-packages/pyln-client/default.nix +++ b/pkgs/python-packages/pyln-client/default.nix @@ -16,5 +16,13 @@ buildPythonPackage rec { checkInputs = [ pytestCheckHook ]; + # TODO-EXTERNAL: + # This patch is a variant (fixed relative path) of + # https://github.com/ElementsProject/lightning/pull/5574. This is already + # fixed upstream. Remove this after the next clightning release. + patches = [ + ./msat-null.patch + ]; + postUnpack = "sourceRoot=$sourceRoot/contrib/${pname}"; } diff --git a/pkgs/python-packages/pyln-client/msat-null.patch b/pkgs/python-packages/pyln-client/msat-null.patch new file mode 100644 index 0000000..ee3c611 --- /dev/null +++ b/pkgs/python-packages/pyln-client/msat-null.patch @@ -0,0 +1,16 @@ +diff --git a/pyln/client/lightning.py b/pyln/client/lightning.py +index 38fc7563f..0013b89a3 100644 +--- a/pyln/client/lightning.py ++++ b/pyln/client/lightning.py +@@ -455,6 +455,11 @@ class LightningRpc(UnixDomainSocketRpc): + if k.endswith('msat'): + if isinstance(v, list): + obj[k] = [Millisatoshi(e) for e in v] ++ # FIXME: Deprecated "listconfigs" gives two 'null' fields: ++ # "lease-fee-base-msat": null, ++ # "channel-fee-max-base-msat": null, ++ elif v is None: ++ obj[k] = None + else: + obj[k] = Millisatoshi(v) + else: