mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-22 13:14:15 +03:00
109dccca27
Enable markdown syntax (instead of docbook) for descriptions. This only affects external doc tooling that renders the descriptions.
79 lines
2.4 KiB
Nix
79 lines
2.4 KiB
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
let
|
|
options.services.clightning.plugins.feeadjuster = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = mdDoc ''
|
|
Enable feeaduster (clightning plugin).
|
|
This plugin auto-updates channel fees to keep channels balanced.
|
|
|
|
See here for all available options:
|
|
https://github.com/lightningd/plugins/blob/master/feeadjuster/feeadjuster.py
|
|
Extra options can be set via `services.clightning.extraConfig`.
|
|
'';
|
|
};
|
|
fuzz = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = mdDoc "Enable update threshold randomization and hysteresis.";
|
|
};
|
|
adjustOnForward = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = mdDoc "Automatically update fees on forward events.";
|
|
};
|
|
method = mkOption {
|
|
type = types.enum [ "soft" "default" "hard" ];
|
|
default = "default";
|
|
description = mdDoc ''
|
|
Adjustment method to calculate channel fees.
|
|
`soft`: less difference when adjusting fees.
|
|
`hard`: greater difference when adjusting fees.
|
|
'';
|
|
};
|
|
adjustDaily = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = mdDoc "Automatically update fees daily.";
|
|
};
|
|
};
|
|
|
|
cfg = config.services.clightning.plugins.feeadjuster;
|
|
inherit (config.services) clightning;
|
|
in
|
|
{
|
|
inherit options;
|
|
|
|
config = mkIf (cfg.enable && clightning.enable) {
|
|
services.clightning.extraConfig = ''
|
|
plugin=${config.nix-bitcoin.pkgs.clightning-plugins.feeadjuster.path}
|
|
feeadjuster-adjustment-method="${cfg.method}"
|
|
'' + optionalString (!cfg.fuzz) ''
|
|
feeadjuster-deactivate-fuzz
|
|
'' + optionalString (!cfg.adjustOnForward) ''
|
|
feeadjuster-deactivate-fee-update
|
|
'';
|
|
|
|
systemd = mkIf cfg.adjustDaily {
|
|
services.clightning-feeadjuster = {
|
|
# Only run when clightning is running
|
|
requisite = [ "clightning.service" ];
|
|
after = [ "clightning.service" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = "clightning";
|
|
ExecStart = "${clightning.package}/bin/lightning-cli --lightning-dir ${clightning.dataDir} feeadjust";
|
|
};
|
|
unitConfig.JoinsNamespaceOf = [ "clightning.service" ];
|
|
startAt = [ "daily" ];
|
|
};
|
|
timers.clightning-feeadjuster.timerConfig = {
|
|
RandomizedDelaySec = "6h";
|
|
};
|
|
};
|
|
};
|
|
}
|