mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 08:31:01 +03:00

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
options,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.bird;
|
|
inherit (lib)
|
|
mkOption
|
|
types
|
|
concatStringsSep
|
|
singleton
|
|
;
|
|
in
|
|
{
|
|
port = 9324;
|
|
extraOpts = {
|
|
birdVersion = mkOption {
|
|
type = types.enum [
|
|
1
|
|
2
|
|
];
|
|
default = 2;
|
|
description = ''
|
|
Specifies whether BIRD1 or BIRD2 is in use.
|
|
'';
|
|
};
|
|
birdSocket = mkOption {
|
|
type = types.path;
|
|
default = "/run/bird/bird.ctl";
|
|
description = ''
|
|
Path to BIRD2 (or BIRD1 v4) socket.
|
|
'';
|
|
};
|
|
newMetricFormat = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = ''
|
|
Enable the new more-generic metric format.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
SupplementaryGroups = singleton (if cfg.birdVersion == 1 then "bird" else "bird2");
|
|
ExecStart = ''
|
|
${pkgs.prometheus-bird-exporter}/bin/bird_exporter \
|
|
-web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
|
-bird.socket ${cfg.birdSocket} \
|
|
-bird.v2=${if cfg.birdVersion == 2 then "true" else "false"} \
|
|
-format.new=${if cfg.newMetricFormat then "true" else "false"} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
RestrictAddressFamilies = [
|
|
# Need AF_UNIX to collect data
|
|
"AF_UNIX"
|
|
];
|
|
};
|
|
};
|
|
}
|