Merge #285: Add CLBOSS

196e3c9dbb clboss: add test todo (nixbitcoin)
f89498d4fc clboss: add module (nixbitcoin)
9423eadcee clboss: add pkg (nixbitcoin)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK 196e3c9dbb
  jonasnick:
    utACK 196e3c9dbb

Tree-SHA512: 1c3e0dd23f45554cd423d1a4d57f936c1a3fd9e25b8332acef67ce6a648b38e55e780e4d393f93a1cbb1e342773e0f4aa039216c6d10641fe7436e7b155cc83f
This commit is contained in:
Jonas Nick 2020-12-22 21:32:00 +00:00
commit 4d1150a671
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
6 changed files with 73 additions and 4 deletions

View File

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.clightning.plugins.clboss; in
{
options.services.clightning.plugins.clboss = {
enable = mkEnableOption "CLBOSS (clightning plugin)";
min-onchain = mkOption {
type = types.ints.positive;
default = 30000;
description = ''
Specify target amount (in satoshi) that CLBOSS will leave onchain.
'';
};
};
config = mkIf cfg.enable {
services.clightning.extraConfig = ''
plugin=${config.nix-bitcoin.pkgs.clboss}/bin/clboss
clboss-min-onchain=${toString cfg.min-onchain}
'';
systemd.services.clightning.path = [
pkgs.dnsutils
] ++ optional config.services.clightning.enforceTor (hiPrio config.nix-bitcoin.torify);
};
}

View File

@ -6,6 +6,7 @@ let
pluginPkgs = config.nix-bitcoin.pkgs.clightning-plugins; pluginPkgs = config.nix-bitcoin.pkgs.clightning-plugins;
in { in {
imports = [ imports = [
./clboss.nix
./prometheus.nix ./prometheus.nix
./summary.nix ./summary.nix
./zmq.nix ./zmq.nix

View File

@ -1,5 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib;
{ {
imports = [ imports = [
# Core modules # Core modules
@ -33,14 +34,27 @@
disabledModules = [ "services/networking/bitcoind.nix" ]; disabledModules = [ "services/networking/bitcoind.nix" ];
options = { options = {
nix-bitcoin-services = lib.mkOption { nix-bitcoin-services = mkOption {
readOnly = true; readOnly = true;
default = import ./nix-bitcoin-services.nix lib pkgs; default = import ./nix-bitcoin-services.nix lib pkgs;
}; };
nix-bitcoin.pkgs = lib.mkOption { nix-bitcoin = {
type = lib.types.attrs; pkgs = mkOption {
default = (import ../pkgs { inherit pkgs; }).modulesPkgs; type = types.attrs;
default = (import ../pkgs { inherit pkgs; }).modulesPkgs;
};
# Torify binary that works with custom Tor SOCKS addresses
# Related issue: https://github.com/NixOS/nixpkgs/issues/94236
torify = mkOption {
readOnly = true;
default = pkgs.writeScriptBin "torify" ''
${pkgs.tor}/bin/torify \
--address ${head (splitString ":" config.services.tor.client.socksListenAddress)} \
"$@"
'';
};
}; };
}; };

26
pkgs/clboss/default.nix Normal file
View File

@ -0,0 +1,26 @@
{ stdenv, fetchurl, pkgconfig, curl, libev, sqlite }:
let
curlWithGnuTLS = curl.override { gnutlsSupport = true; sslSupport = false; };
in
stdenv.mkDerivation rec {
pname = "clboss";
version = "0.10";
src = fetchurl {
url = "https://github.com/ZmnSCPxj/clboss/releases/download/v${version}/clboss-${version}.tar.gz";
sha256 = "1bmlpfhsjs046qx2ikln15rj4kal32752zs1s5yjklsq9xwnbciz";
};
nativeBuildInputs = [ pkgconfig libev curlWithGnuTLS sqlite ];
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "Automated C-Lightning Node Manager";
homepage = "https://github.com/ZmnSCPxj/clboss";
maintainers = with maintainers; [ nixbitcoin ];
license = licenses.mit;
platforms = platforms.linux;
};
}

View File

@ -14,6 +14,7 @@ let self = {
lightning-loop = pkgs.callPackage ./lightning-loop { }; lightning-loop = pkgs.callPackage ./lightning-loop { };
extra-container = pkgs.callPackage ./extra-container { }; extra-container = pkgs.callPackage ./extra-container { };
clightning-plugins = import ./clightning-plugins pkgs self.nbPython3Packages; clightning-plugins = import ./clightning-plugins pkgs self.nbPython3Packages;
clboss = pkgs.callPackage ./clboss { };
nbPython3Packages = (pkgs.python3.override { nbPython3Packages = (pkgs.python3.override {
packageOverrides = pySelf: super: import ./python-packages self pySelf; packageOverrides = pySelf: super: import ./python-packages self pySelf;

View File

@ -79,6 +79,7 @@ let testEnv = rec {
} }
(mkIf config.test.features.clightningPlugins { (mkIf config.test.features.clightningPlugins {
services.clightning.plugins = { services.clightning.plugins = {
# TODO: add clboss when https://github.com/ZmnSCPxj/clboss/issues/49 is closed
helpme.enable = true; helpme.enable = true;
monitor.enable = true; monitor.enable = true;
prometheus.enable = true; prometheus.enable = true;