2020-11-18 18:01:45 -08:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let cfg = config.services.clightning.plugins.summary; in
|
|
|
|
{
|
|
|
|
options.services.clightning.plugins.summary = {
|
|
|
|
enable = mkEnableOption "Summary (clightning plugin)";
|
|
|
|
currency = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "USD";
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "The currency to look up on btcaverage.";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
currencyPrefix = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "USD $";
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "The prefix to use for the currency.";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
availabilityInterval = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 300;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "How often in seconds the availability should be calculated.";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
availabilityWindow = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 72;
|
2022-12-18 04:13:47 -08:00
|
|
|
description = mdDoc "How many hours the availability should be averaged over.";
|
2020-11-18 18:01:45 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.clightning.extraConfig = ''
|
|
|
|
plugin=${config.nix-bitcoin.pkgs.clightning-plugins.summary.path}
|
|
|
|
summary-currency="${cfg.currency}"
|
|
|
|
summary-currency-prefix="${cfg.currencyPrefix}"
|
|
|
|
summary-availability-interval=${toString cfg.availabilityInterval}
|
|
|
|
summary-availability-window=${toString cfg.availabilityWindow}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|