mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00

As the configuration for the exporters and alertmanager is unchanged between the two major versions this patch tries to minimize duplication while at the same time as there's no upgrade path from 1.x to 2.x, it allows running the two services in parallel. See also #56037
37 lines
776 B
Nix
37 lines
776 B
Nix
{ config, lib, pkgs }:
|
|
|
|
with lib;
|
|
|
|
baseCfg:
|
|
let
|
|
cfg = baseCfg.json;
|
|
in
|
|
{
|
|
port = 7979;
|
|
extraOpts = {
|
|
url = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
URL to scrape JSON from.
|
|
'';
|
|
};
|
|
configFile = mkOption {
|
|
type = types.path;
|
|
description = ''
|
|
Path to configuration file.
|
|
'';
|
|
};
|
|
listenAddress = {}; # not used
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
ExecStart = ''
|
|
${pkgs.prometheus-json-exporter}/bin/prometheus-json-exporter \
|
|
--port ${toString cfg.port} \
|
|
${cfg.url} ${cfg.configFile} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
};
|
|
};
|
|
}
|