2020-12-21 03:19:15 -08:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let cfg = config.services.clightning.plugins.clboss; in
|
|
|
|
{
|
|
|
|
options.services.clightning.plugins.clboss = {
|
2022-04-25 02:19:10 -07:00
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
2022-05-05 07:58:16 -07:00
|
|
|
default = false;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc ''
|
2022-04-25 02:19:10 -07:00
|
|
|
Whether to enable CLBOSS (clightning plugin).
|
|
|
|
See also: https://github.com/ZmnSCPxj/clboss#operating
|
|
|
|
'';
|
|
|
|
};
|
2020-12-21 03:19:15 -08:00
|
|
|
min-onchain = mkOption {
|
|
|
|
type = types.ints.positive;
|
|
|
|
default = 30000;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc ''
|
2021-11-26 06:13:29 -08:00
|
|
|
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.
|
2020-12-21 03:19:15 -08:00
|
|
|
'';
|
|
|
|
};
|
2022-04-25 02:19:10 -07:00
|
|
|
min-channel = mkOption {
|
|
|
|
type = types.ints.positive;
|
|
|
|
default = 500000;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "The minimum size (in satoshi) of channels created by CLBOSS.";
|
2022-04-25 02:19:10 -07:00
|
|
|
};
|
|
|
|
max-channel = mkOption {
|
|
|
|
type = types.ints.positive;
|
|
|
|
default = 16777215;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "The maximum size (in satoshi) of channels created by CLBOSS.";
|
2022-04-25 02:19:10 -07:00
|
|
|
};
|
|
|
|
zerobasefee = mkOption {
|
|
|
|
type = types.enum [ "require" "allow" "disallow" ];
|
|
|
|
default = "allow";
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc ''
|
|
|
|
`require`: set `base_fee` to 0.
|
|
|
|
`allow`: set `base_fee` according to the CLBOSS heuristics, which may include value 0.
|
|
|
|
`disallow`: set `base_fee` to according to the CLBOSS heuristics, with a minimum value of 1.
|
2022-04-25 02:19:10 -07:00
|
|
|
'';
|
|
|
|
};
|
2021-04-11 05:40:37 -07:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = config.nix-bitcoin.pkgs.clboss;
|
2021-12-07 19:07:28 -08:00
|
|
|
defaultText = "config.nix-bitcoin.pkgs.clboss";
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "The package providing clboss binaries.";
|
2021-04-11 05:40:37 -07:00
|
|
|
};
|
2020-12-21 03:19:15 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.clightning.extraConfig = ''
|
2021-04-11 05:40:37 -07:00
|
|
|
plugin=${cfg.package}/bin/clboss
|
2020-12-21 03:19:15 -08:00
|
|
|
clboss-min-onchain=${toString cfg.min-onchain}
|
2022-04-25 02:19:10 -07:00
|
|
|
clboss-min-channel=${toString cfg.min-channel}
|
|
|
|
clboss-max-channel=${toString cfg.max-channel}
|
|
|
|
clboss-zerobasefee=${cfg.zerobasefee}
|
2020-12-21 03:19:15 -08:00
|
|
|
'';
|
|
|
|
systemd.services.clightning.path = [
|
|
|
|
pkgs.dnsutils
|
2021-11-28 12:24:49 -08:00
|
|
|
] ++ optional config.services.clightning.tor.proxy (hiPrio config.nix-bitcoin.torify);
|
2020-12-21 03:19:15 -08:00
|
|
|
};
|
|
|
|
}
|