12 cfg = config.services.xinetd;
14 configFile = pkgs.writeText "xinetd.conf" ''
17 log_type = SYSLOG daemon info
19 log_on_success = PID HOST DURATION EXIT
23 ${concatMapStrings makeService cfg.services}
29 protocol = ${srv.protocol}
30 ${optionalString srv.unlisted "type = UNLISTED"}
31 ${optionalString (srv.flags != "") "flags = ${srv.flags}"}
32 socket_type = ${if srv.protocol == "udp" then "dgram" else "stream"}
33 ${optionalString (srv.port != 0) "port = ${toString srv.port}"}
34 wait = ${if srv.protocol == "udp" then "yes" else "no"}
36 server = ${srv.server}
37 ${optionalString (srv.serverArgs != "") "server_args = ${srv.serverArgs}"}
50 services.xinetd.enable = mkEnableOption "the xinetd super-server daemon";
52 services.xinetd.extraDefaults = mkOption {
56 Additional configuration lines added to the default section of xinetd's configuration.
60 services.xinetd.services = mkOption {
63 A list of services provided by xinetd.
75 description = "Name of the service.";
81 description = "Protocol of the service. Usually `tcp` or `udp`.";
88 description = "Port number of the service.";
94 description = "User account for the service";
99 example = "/foo/bin/ftpd";
100 description = "Path of the program that implements the service.";
103 serverArgs = mkOption {
104 type = types.separatedString " ";
106 description = "Command-line arguments for the server program.";
115 unlisted = mkOption {
119 Whether this server is listed in
120 {file}`/etc/services`. If so, the port
121 number can be omitted.
125 extraConfig = mkOption {
128 description = "Extra configuration-lines added to the section of the service.";
139 ###### implementation
141 config = mkIf cfg.enable {
142 systemd.services.xinetd = {
143 description = "xinetd server";
144 after = [ "network.target" ];
145 wantedBy = [ "multi-user.target" ];
146 path = [ pkgs.xinetd ];
147 script = "exec xinetd -syslog daemon -dontfork -stayalive -f ${configFile}";