This enables generating module option documentation.
This commit was genereated by running the following script inside the
repo root dir:
def add_default_text(file)
src = File.read(file)
src2 = src.gsub(/( = mkOption\s+\{[^{]*?)(\n\s+default = )(.*?);$(.*?\})/m) do |str|
pre, defaultVar, default, post = Regexp.last_match.captures
replacement =
if !post.include?('defaultText =')
if default =~ /\bpkgs\b/
defaultText = default.lines.length == 1 ? default : "(See source)"
"#{pre}#{defaultVar}#{default};#{defaultVar.sub('default', 'defaultText')}#{defaultText.inspect};#{post}"
end
end
replacement or str
end
File.write(file, src2) if src2 != src
end
Dir["modules/**/*.nix"].each do |f|
next if File.basename(f) == "nix-bitcoin.nix"
add_default_text f
end
34 lines
1.1 KiB
Nix
34 lines
1.1 KiB
Nix
{ 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 = ''
|
|
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 {
|
|
type = types.package;
|
|
default = config.nix-bitcoin.pkgs.clboss;
|
|
defaultText = "config.nix-bitcoin.pkgs.clboss";
|
|
description = "The package providing clboss binaries.";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.clightning.extraConfig = ''
|
|
plugin=${cfg.package}/bin/clboss
|
|
clboss-min-onchain=${toString cfg.min-onchain}
|
|
'';
|
|
systemd.services.clightning.path = [
|
|
pkgs.dnsutils
|
|
] ++ optional config.services.clightning.tor.proxy (hiPrio config.nix-bitcoin.torify);
|
|
};
|
|
}
|