about summary refs log tree commit diff
path: root/nixos/modules/services/web-servers/apache-httpd/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-29 14:03:39 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-29 14:03:39 +0100
commit985f1f2d8a51c06c7c57d1009dc3589589c8c342 (patch)
tree1af2c10cf6799faf9ab3ce07c383ddd0007ff1bb /nixos/modules/services/web-servers/apache-httpd/default.nix
parent0afdb1e933b2089e7cf00df4ef1646d639f70d81 (diff)
downloadnixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar.gz
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar.bz2
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar.lz
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar.xz
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.tar.zst
nixlib-985f1f2d8a51c06c7c57d1009dc3589589c8c342.zip
Give types to the Apache httpd options
Diffstat (limited to 'nixos/modules/services/web-servers/apache-httpd/default.nix')
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix83
1 files changed, 47 insertions, 36 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index f6d5ac2fa558..e9cf9ae5e3e6 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -30,7 +30,7 @@ let
 
     # Admin address: inherit from the main server if not specified for
     # a virtual host.
-    adminAddr = if cfg.adminAddr != "" then cfg.adminAddr else mainCfg.adminAddr;
+    adminAddr = if cfg.adminAddr != null then cfg.adminAddr else mainCfg.adminAddr;
 
     vhostConfig = cfg;
     serverConfig = mainCfg;
@@ -217,7 +217,7 @@ let
 
     ${concatMapStrings (alias: "ServerAlias ${alias}\n") cfg.serverAliases}
 
-    ${if cfg.sslServerCert != "" then ''
+    ${if cfg.sslServerCert != null then ''
       SSLCertificateFile ${cfg.sslServerCert}
       SSLCertificateKeyFile ${cfg.sslServerKey}
     '' else ""}
@@ -229,7 +229,7 @@ let
       SSLEngine off
     '' else ""}
 
-    ${if isMainServer || cfg.adminAddr != "" then ''
+    ${if isMainServer || cfg.adminAddr != null then ''
       ServerAdmin ${cfg.adminAddr}
     '' else ""}
 
@@ -260,7 +260,7 @@ let
 
     '' else ""}
 
-    ${if cfg.globalRedirect != "" then ''
+    ${if cfg.globalRedirect != null then ''
       RedirectPermanent / ${cfg.globalRedirect}
     '' else ""}
 
@@ -408,96 +408,104 @@ in
     services.httpd = {
 
       enable = mkOption {
+        type = types.bool;
         default = false;
-        description = "
-          Whether to enable the Apache httpd server.
-        ";
+        description = "Whether to enable the Apache HTTP Server.";
       };
 
       package = mkOption {
+        type = types.path;
         default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
         example = "pkgs.apacheHttpd_2_4";
-        description = "
+        description = ''
           Overridable attribute of the Apache HTTP Server package to use.
-        ";
+        '';
       };
 
       configFile = mkOption {
+        type = types.path;
         default = confFile;
         example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";'';
-        description = "
-          Overridable config file to use for Apache. By default, use the
-          file automatically generated by nixos.
-        ";
+        description = ''
+          Override the configuration file used by Apache. By default,
+          NixOS generates one automatically.
+        '';
       };
 
       extraConfig = mkOption {
+        type = types.lines;
         default = "";
-        description = "
-          These configuration lines will be appended to the Apache config
-          file. Note that this mechanism may not work when <option>configFile</option>
-          is overridden.
-        ";
+        description = ''
+          Cnfiguration lines appended to the generated Apache
+          configuration file. Note that this mechanism may not work
+          when <option>configFile</option> is overridden.
+        '';
       };
 
       extraModules = mkOption {
+        type = types.listOf types.unspecified;
         default = [];
         example = [ "proxy_connect" { name = "php5"; path = "${php}/modules/libphp5.so"; } ];
         description = ''
-          Specifies additional Apache modules.  These can be specified
-          as a string in the case of modules distributed with Apache,
-          or as an attribute set specifying the
+          Additional Apache modules to be used.  These can be
+          specified as a string in the case of modules distributed
+          with Apache, or as an attribute set specifying the
           <varname>name</varname> and <varname>path</varname> of the
           module.
         '';
       };
 
       logPerVirtualHost = mkOption {
+        type = types.bool;
         default = false;
-        description = "
+        description = ''
           If enabled, each virtual host gets its own
           <filename>access_log</filename> and
           <filename>error_log</filename>, namely suffixed by the
           <option>hostName</option> of the virtual host.
-        ";
+        '';
       };
 
       user = mkOption {
+        type = types.str;
         default = "wwwrun";
-        description = "
+        description = ''
           User account under which httpd runs.  The account is created
           automatically if it doesn't exist.
-        ";
+        '';
       };
 
       group = mkOption {
+        type = types.str;
         default = "wwwrun";
-        description = "
+        description = ''
           Group under which httpd runs.  The account is created
           automatically if it doesn't exist.
-        ";
+        '';
       };
 
       logDir = mkOption {
+        type = types.path;
         default = "/var/log/httpd";
-        description = "
+        description = ''
           Directory for Apache's log files.  It is created automatically.
-        ";
+        '';
       };
 
       stateDir = mkOption {
-        default = "/var/run/httpd";
-        description = "
+        type = types.path;
+        default = "/run/httpd";
+        description = ''
           Directory for Apache's transient runtime state (such as PID
           files).  It is created automatically.  Note that the default,
-          <filename>/var/run/httpd</filename>, is deleted at boot time.
-        ";
+          <filename>/run/httpd</filename>, is deleted at boot time.
+        '';
       };
 
       virtualHosts = mkOption {
         type = types.listOf (types.submodule (
           { options = import ./per-server-options.nix {
-              inherit mkOption;
+              inherit pkgs;
               forMainServer = false;
             };
           }));
@@ -519,6 +527,7 @@ in
       };
 
       phpOptions = mkOption {
+        type = types.lines;
         default = "";
         example =
           ''
@@ -529,9 +538,9 @@ in
       };
 
       multiProcessingModule = mkOption {
+        type = types.str;
         default = "prefork";
         example = "worker";
-        type = types.uniq types.string;
         description =
           ''
             Multi-processing module to be used by Apache.  Available
@@ -546,12 +555,14 @@ in
       };
 
       maxClients = mkOption {
+        type = types.int;
         default = 150;
         example = 8;
         description = "Maximum number of httpd processes (prefork)";
       };
 
       maxRequestsPerChild = mkOption {
+        type = types.int;
         default = 0;
         example = 500;
         description =
@@ -561,7 +572,7 @@ in
 
     # Include the options shared between the main server and virtual hosts.
     // (import ./per-server-options.nix {
-      inherit mkOption;
+      inherit pkgs;
       forMainServer = true;
     });