mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-11 18:23:18 +01:00
57 lines
1.1 KiB
Nix
57 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.kafka;
|
|
inherit (lib)
|
|
mkIf
|
|
mkOption
|
|
mkMerge
|
|
types
|
|
concatStringsSep
|
|
;
|
|
in
|
|
{
|
|
port = 8080;
|
|
|
|
extraOpts = {
|
|
package = lib.mkPackageOption pkgs "kminion" { };
|
|
|
|
environmentFile = mkOption {
|
|
type = with types; nullOr path;
|
|
default = null;
|
|
description = ''
|
|
File containing the credentials to access the repository, in the
|
|
format of an EnvironmentFile as described by systemd.exec(5)
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = mkMerge (
|
|
[
|
|
{
|
|
serviceConfig = {
|
|
ExecStart = ''
|
|
${lib.getExe cfg.package}
|
|
'';
|
|
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
|
RestartSec = "5s";
|
|
RestrictAddressFamilies = [
|
|
"AF_INET"
|
|
"AF_INET6"
|
|
];
|
|
};
|
|
}
|
|
]
|
|
++ [
|
|
(mkIf config.services.apache-kafka.enable {
|
|
after = [ "apache-kafka.service" ];
|
|
requires = [ "apache-kafka.service" ];
|
|
})
|
|
]
|
|
);
|
|
}
|