From bd275d3a9ad45d950e157821d4345d2d37257c08 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 26 Nov 2021 15:13:29 +0100 Subject: [PATCH] minor improvements - README: - Add RTL - examples/configuration.nix: - Fix comment - btcpayserver.nix: - Use nbLib.addressWithPort - Embed optionalString like the other optionalStrings - clboss.nix: - Improve description - clightning.nix: - Option `extraConfig`: Add example, improve description. - Disable `log-timestamps`. Timestamps are already logged via journald. - Simplify `preStart` script - electrs.nix: - Use `port` description wording like in other services. --- README.md | 1 + examples/configuration.nix | 2 +- modules/btcpayserver.nix | 5 +++-- modules/clightning-plugins/clboss.nix | 4 +++- modules/clightning.nix | 17 ++++++++++++++--- modules/electrs.nix | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dea57e3..8c9d614 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ NixOS modules ([src](modules/modules.nix)) * [Lightning Pool](https://github.com/lightninglabs/pool) * [charge-lnd](https://github.com/accumulator/charge-lnd): policy-based channel fee manager * [lndconnect](https://github.com/LN-Zap/lndconnect) via a REST onion service + * [Ride The Lightning](https://github.com/Ride-The-Lightning/RTL): web interface for `lnd` and `clightning` * [spark-wallet](https://github.com/shesek/spark-wallet) * [electrs](https://github.com/romanz/electrs) * [btcpayserver](https://github.com/btcpayserver/btcpayserver) diff --git a/examples/configuration.nix b/examples/configuration.nix index 66212ff..4e75f64 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -16,7 +16,7 @@ # See the comments at the top of `hardened-extended.nix` for further details. # - # FIXME: Uncomment next line to import your hardware configuration. If so, + # FIXME: Uncomment the next line to import your hardware configuration. If so, # add the hardware configuration file to the same directory as this file. #./hardware-configuration.nix ]; diff --git a/modules/btcpayserver.nix b/modules/btcpayserver.nix index 5143b48..55b709a 100644 --- a/modules/btcpayserver.nix +++ b/modules/btcpayserver.nix @@ -186,7 +186,7 @@ in { }; systemd.services.btcpayserver = let - nbExplorerUrl = "http://${cfg.nbxplorer.address}:${toString cfg.nbxplorer.port}/"; + nbExplorerUrl = "http://${nbLib.addressWithPort cfg.nbxplorer.address cfg.nbxplorer.port}/"; nbExplorerCookie = "${cfg.nbxplorer.dataDir}/${bitcoind.makeNetworkName "Main" "RegTest"}/.cookie"; configFile = builtins.toFile "config" ('' network=${bitcoind.network} @@ -196,7 +196,8 @@ in { btcexplorerurl=${nbExplorerUrl} btcexplorercookiefile=${nbExplorerCookie} postgres=User ID=${cfg.btcpayserver.user};Host=/run/postgresql;Database=btcpaydb - ${optionalString (cfg.btcpayserver.rootpath != null) "rootpath=${cfg.btcpayserver.rootpath}"} + '' + optionalString (cfg.btcpayserver.rootpath != null) '' + rootpath=${cfg.btcpayserver.rootpath} '' + optionalString (cfg.btcpayserver.lightningBackend == "clightning") '' btclightning=type=clightning;server=unix:///${cfg.clightning.dataDir}/bitcoin/lightning-rpc '' + optionalString cfg.btcpayserver.lbtc '' diff --git a/modules/clightning-plugins/clboss.nix b/modules/clightning-plugins/clboss.nix index c50c85e..c07122c 100644 --- a/modules/clightning-plugins/clboss.nix +++ b/modules/clightning-plugins/clboss.nix @@ -9,7 +9,9 @@ let cfg = config.services.clightning.plugins.clboss; in type = types.ints.positive; default = 30000; description = '' - Specify target amount (in satoshi) that CLBOSS will leave onchain. + Target amount (in satoshi) that CLBOSS will leave on-chain. + clboss will only open new channels if this amount is smaller than + the funds in your clightning wallet. ''; }; package = mkOption { diff --git a/modules/clightning.nix b/modules/clightning.nix index 44809e4..f9a41d3 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -43,7 +43,16 @@ let extraConfig = mkOption { type = types.lines; default = ""; - description = "Extra lines appended to the configuration file."; + example = '' + alias=mynode + ''; + description = '' + Extra lines appended to the configuration file. + + See all available options at + https://github.com/ElementsProject/lightning/blob/master/doc/lightningd-config.5.md + or by running `lightningd --help`. + ''; }; user = mkOption { type = types.str; @@ -88,6 +97,7 @@ let bitcoin-rpcport=${toString config.services.bitcoind.rpc.port} bitcoin-rpcuser=${config.services.bitcoind.rpc.users.public.name} rpc-file-mode=0660 + log-timestamps=false ${cfg.extraConfig} ''; @@ -123,13 +133,14 @@ in { preStart = '' # The RPC socket has to be removed otherwise we might have stale sockets rm -f ${cfg.networkDir}/lightning-rpc - install -m 640 ${configFile} '${cfg.dataDir}/config' + umask u=rw,g=r,o= { + cat ${configFile} echo "bitcoin-rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword-public)" ${optionalString (cfg.getPublicAddressCmd != "") '' echo "announce-addr=$(${cfg.getPublicAddressCmd}):${toString publicPort}" ''} - } >> '${cfg.dataDir}/config' + } > '${cfg.dataDir}/config' ''; serviceConfig = nbLib.defaultHardening // { ExecStart = "${nbPkgs.clightning}/bin/lightningd --lightning-dir=${cfg.dataDir}"; diff --git a/modules/electrs.nix b/modules/electrs.nix index 3dee769..5f9b042 100644 --- a/modules/electrs.nix +++ b/modules/electrs.nix @@ -12,7 +12,7 @@ let port = mkOption { type = types.port; default = 50001; - description = "RPC port."; + description = "Port to listen for RPC connections."; }; dataDir = mkOption { type = types.path;