summary refs log tree commit diff
path: root/nixos/modules/services/web-servers/fcgiwrap.nix
blob: 7e91e7b60eef33a4cdad2d573a3800c9db3bc34d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.fcgiwrap;

in {

  options = {
    services.fcgiwrap = {
      enable = mkOption {
        type = types.bool;
        default = false;
        description = "Whether to enable fcgiwrap, a server for running CGI applications over FastCGI.";
      };

      preforkProcesses = mkOption {
        type = types.int;
        default = 1;
        description = "Number of processes to prefork.";
      };

      bindSocket = mkOption {
        type = types.string;
        default = "unix:/run/fcgiwrap.sock";
        description = ''
          Socket to bind to. Valid socket URLs are:
            unix:/path/to/socket for Unix sockets
            tcp:dot.ted.qu.ad:port for IPv4 sockets
            tcp6:[ipv6_addr]:port for IPv6 sockets
        '';
      };
    };
  };

  config = mkIf cfg.enable {

    systemd.services.fcgiwrap = {
      after = [ "nss-user-lookup.target" ];
      wantedBy = [ "multi-user.target" ];

      serviceConfig = {
        ExecStart = "${pkgs.fcgiwrap}/sbin/fcgiwrap -c ${builtins.toString cfg.preforkProcesses} -s ${cfg.bindSocket}";
      };
    };

  };
}