1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8let 9 cfg = config.services.prometheus.exporters.kafka; 10 inherit (lib) 11 mkIf 12 mkOption 13 mkMerge 14 types 15 concatStringsSep 16 ; 17in 18{ 19 port = 8080; 20 21 extraOpts = { 22 package = lib.mkPackageOption pkgs "kminion" { }; 23 24 environmentFile = mkOption { 25 type = with types; nullOr path; 26 default = null; 27 description = '' 28 File containing the credentials to access the repository, in the 29 format of an EnvironmentFile as described by systemd.exec(5) 30 ''; 31 }; 32 }; 33 serviceOpts = mkMerge ( 34 [ 35 { 36 serviceConfig = { 37 ExecStart = '' 38 ${lib.getExe cfg.package} 39 ''; 40 EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile; 41 RestartSec = "5s"; 42 RestrictAddressFamilies = [ 43 "AF_INET" 44 "AF_INET6" 45 ]; 46 }; 47 } 48 ] 49 ++ [ 50 (mkIf config.services.apache-kafka.enable { 51 after = [ "apache-kafka.service" ]; 52 requires = [ "apache-kafka.service" ]; 53 }) 54 ] 55 ); 56}