mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-05 07:12:34 +03:00

Fixes issues described in #208242 for this part of the nixpkgs tree. There are no behavioral changes in this, it only adjusts the code so that it is easier to understand.
45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
{ config, lib, pkgs, options, ... }:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.lnd;
|
|
inherit (lib) mkOption types concatStringsSep;
|
|
in
|
|
{
|
|
port = 9092;
|
|
extraOpts = {
|
|
lndHost = mkOption {
|
|
type = types.str;
|
|
default = "localhost:10009";
|
|
description = ''
|
|
lnd instance gRPC address:port.
|
|
'';
|
|
};
|
|
|
|
lndTlsPath = mkOption {
|
|
type = types.path;
|
|
description = ''
|
|
Path to lnd TLS certificate.
|
|
'';
|
|
};
|
|
|
|
lndMacaroonDir = mkOption {
|
|
type = types.path;
|
|
description = ''
|
|
Path to lnd macaroons.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts.serviceConfig = {
|
|
ExecStart = ''
|
|
${pkgs.prometheus-lnd-exporter}/bin/lndmon \
|
|
--prometheus.listenaddr=${cfg.listenAddress}:${toString cfg.port} \
|
|
--prometheus.logdir=/var/log/prometheus-lnd-exporter \
|
|
--lnd.host=${cfg.lndHost} \
|
|
--lnd.tlspath=${cfg.lndTlsPath} \
|
|
--lnd.macaroondir=${cfg.lndMacaroonDir} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
LogsDirectory = "prometheus-lnd-exporter";
|
|
ReadOnlyPaths = [ cfg.lndTlsPath cfg.lndMacaroonDir ];
|
|
};
|
|
}
|