about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/networking/nghttpx/nghttpx-options.nix
blob: 82ab8c4223e60a9e79eda1177319c077f252bc39 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{ lib, ... }:
{ options.services.nghttpx = {
    enable = lib.mkEnableOption (lib.mdDoc "nghttpx");

    frontends = lib.mkOption {
      type        = lib.types.listOf (lib.types.submodule (import ./frontend-submodule.nix));
      description = lib.mdDoc ''
        A list of frontend listener specifications.
      '';
      example = [
        { server = {
            host = "*";
            port = 80;
          };

          params = {
            tls = "no-tls";
          };
        }
      ];
    };

    backends  = lib.mkOption {
      type = lib.types.listOf (lib.types.submodule (import ./backend-submodule.nix));
      description = lib.mdDoc ''
        A list of backend specifications.
      '';
      example = [
        { server = {
            host = "172.16.0.22";
            port = 8443;
          };
          patterns = [ "/" ];
          params   = {
            proto               = "http/1.1";
            redirect-if-not-tls = true;
          };
        }
      ];
    };

    tls = lib.mkOption {
      type        = lib.types.nullOr (lib.types.submodule (import ./tls-submodule.nix));
      default     = null;
      description = lib.mdDoc ''
        TLS certificate and key paths. Note that this does not enable
        TLS for a frontend listener, to do so, a frontend
        specification must set `params.tls` to true.
      '';
      example = {
        key = "/etc/ssl/keys/server.key";
        crt = "/etc/ssl/certs/server.crt";
      };
    };

    extraConfig = lib.mkOption {
      type        = lib.types.lines;
      default     = "";
      description = lib.mdDoc ''
        Extra configuration options to be appended to the generated
        configuration file.
      '';
    };

    single-process = lib.mkOption {
      type        = lib.types.bool;
      default     = false;
      description = lib.mdDoc ''
        Run this program in a single process mode for debugging
        purpose. Without this option, nghttpx creates at least 2
        processes: master and worker processes. If this option is
        used, master and worker are unified into a single
        process. nghttpx still spawns additional process if neverbleed
        is used. In the single process mode, the signal handling
        feature is disabled.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx--single-process
      '';
    };

    backlog = lib.mkOption {
      type        = lib.types.int;
      default     = 65536;
      description = lib.mdDoc ''
        Listen backlog size.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx--backlog
      '';
    };

    backend-address-family = lib.mkOption {
      type = lib.types.enum [
        "auto"
        "IPv4"
        "IPv6"
      ];
      default = "auto";
      description = lib.mdDoc ''
        Specify address family of backend connections. If "auto" is
        given, both IPv4 and IPv6 are considered. If "IPv4" is given,
        only IPv4 address is considered. If "IPv6" is given, only IPv6
        address is considered.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx--backend-address-family
      '';
    };

    workers = lib.mkOption {
      type        = lib.types.int;
      default     = 1;
      description = lib.mdDoc ''
        Set the number of worker threads.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx-n
      '';
    };

    single-thread = lib.mkOption {
      type        = lib.types.bool;
      default     = false;
      description = lib.mdDoc ''
        Run everything in one thread inside the worker process. This
        feature is provided for better debugging experience, or for
        the platforms which lack thread support. If threading is
        disabled, this option is always enabled.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx--single-thread
      '';
    };

    rlimit-nofile = lib.mkOption {
      type        = lib.types.int;
      default     = 0;
      description = lib.mdDoc ''
        Set maximum number of open files (RLIMIT_NOFILE) to \<N\>. If 0
        is given, nghttpx does not set the limit.

        Please see https://nghttp2.org/documentation/nghttpx.1.html#cmdoption-nghttpx--rlimit-nofile
      '';
    };
  };
}