···
cfg = config.services.fcgiwrap;
···
description = "Number of processes to prefork.";
24
-
bindSocket = mkOption {
25
-
type = types.string;
26
-
default = "unix:/run/fcgiwrap.sock";
28
-
Socket to bind to. Valid socket URLs are:
29
-
unix:/path/to/socket for Unix sockets
30
-
tcp:dot.ted.qu.ad:port for IPv4 sockets
31
-
tcp6:[ipv6_addr]:port for IPv6 sockets
23
+
socketType = mkOption {
24
+
type = types.addCheck types.str (t: t == "unix" || t == "tcp" || t == "tcp6");
26
+
description = "Socket type: 'unix', 'tcp' or 'tcp6'.";
29
+
socketAddress = mkOption {
31
+
default = "/run/fcgiwrap.sock";
32
+
example = "1.2.3.4:5678";
33
+
description = "Socket address. In case of a UNIX socket, this should be its filesystem path.";
37
+
type = types.nullOr types.str;
39
+
description = "User permissions for the socket.";
43
+
type = types.nullOr types.str;
45
+
description = "Group permissions for the socket.";
config = mkIf cfg.enable {
systemd.services.fcgiwrap = {
after = [ "nss-user-lookup.target" ];
41
-
wantedBy = [ "multi-user.target" ];
53
+
wantedBy = optional (cfg.socketType != "unix") "multi-user.target";
44
-
ExecStart = "${pkgs.fcgiwrap}/sbin/fcgiwrap -c ${builtins.toString cfg.preforkProcesses} -s ${cfg.bindSocket}";
56
+
ExecStart = "${pkgs.fcgiwrap}/sbin/fcgiwrap -c ${builtins.toString cfg.preforkProcesses} ${
57
+
if (cfg.socketType != "unix") then "-s ${cfg.socketType}:${cfg.socketAddress}" else ""
59
+
} // (if cfg.user != null && cfg.group != null then {
65
+
systemd.sockets = if (cfg.socketType == "unix") then {
67
+
wantedBy = [ "sockets.target" ];
68
+
socketConfig.ListenStream = cfg.socketAddress;