at 16.09-beta 4.3 kB view raw
1# This file defines the options that can be used both for the Apache 2# main server configuration, and for the virtual hosts. (The latter 3# has additional options that affect the web server as a whole, like 4# the user/group to run under.) 5 6{ forMainServer, lib }: 7 8with lib; 9 10{ 11 12 hostName = mkOption { 13 type = types.str; 14 default = "localhost"; 15 description = "Canonical hostname for the server."; 16 }; 17 18 serverAliases = mkOption { 19 type = types.listOf types.str; 20 default = []; 21 example = ["www.example.org" "www.example.org:8080" "example.org"]; 22 description = '' 23 Additional names of virtual hosts served by this virtual host configuration. 24 ''; 25 }; 26 27 port = mkOption { 28 type = types.int; 29 default = 0; 30 description = '' 31 Port for the server. 0 means use the default port: 80 for http 32 and 443 for https (i.e. when enableSSL is set). 33 ''; 34 }; 35 36 enableSSL = mkOption { 37 type = types.bool; 38 default = false; 39 description = "Whether to enable SSL (https) support."; 40 }; 41 42 # Note: sslServerCert and sslServerKey can be left empty, but this 43 # only makes sense for virtual hosts (they will inherit from the 44 # main server). 45 46 sslServerCert = mkOption { 47 type = types.nullOr types.path; 48 default = null; 49 example = "/var/host.cert"; 50 description = "Path to server SSL certificate."; 51 }; 52 53 sslServerKey = mkOption { 54 type = types.path; 55 example = "/var/host.key"; 56 description = "Path to server SSL certificate key."; 57 }; 58 59 sslServerChain = mkOption { 60 type = types.nullOr types.path; 61 default = null; 62 example = "/var/ca.pem"; 63 description = "Path to server SSL chain file."; 64 }; 65 66 adminAddr = mkOption ({ 67 type = types.nullOr types.str; 68 example = "admin@example.org"; 69 description = "E-mail address of the server administrator."; 70 } // (if forMainServer then {} else {default = null;})); 71 72 documentRoot = mkOption { 73 type = types.nullOr types.path; 74 default = null; 75 example = "/data/webserver/docs"; 76 description = '' 77 The path of Apache's document root directory. If left undefined, 78 an empty directory in the Nix store will be used as root. 79 ''; 80 }; 81 82 servedDirs = mkOption { 83 type = types.listOf types.attrs; 84 default = []; 85 example = [ 86 { urlPath = "/nix"; 87 dir = "/home/eelco/Dev/nix-homepage"; 88 } 89 ]; 90 description = '' 91 This option provides a simple way to serve static directories. 92 ''; 93 }; 94 95 servedFiles = mkOption { 96 type = types.listOf types.attrs; 97 default = []; 98 example = [ 99 { urlPath = "/foo/bar.png"; 100 files = "/home/eelco/some-file.png"; 101 } 102 ]; 103 description = '' 104 This option provides a simple way to serve individual, static files. 105 ''; 106 }; 107 108 extraConfig = mkOption { 109 type = types.lines; 110 default = ""; 111 example = '' 112 <Directory /home> 113 Options FollowSymlinks 114 AllowOverride All 115 </Directory> 116 ''; 117 description = '' 118 These lines go to httpd.conf verbatim. They will go after 119 directories and directory aliases defined by default. 120 ''; 121 }; 122 123 extraSubservices = mkOption { 124 type = types.listOf types.unspecified; 125 default = []; 126 description = "Extra subservices to enable in the webserver."; 127 }; 128 129 enableUserDir = mkOption { 130 type = types.bool; 131 default = false; 132 description = '' 133 Whether to enable serving <filename>~/public_html</filename> as 134 <literal>/~<replaceable>username</replaceable></literal>. 135 ''; 136 }; 137 138 globalRedirect = mkOption { 139 type = types.nullOr types.str; 140 default = null; 141 example = http://newserver.example.org/; 142 description = '' 143 If set, all requests for this host are redirected permanently to 144 the given URL. 145 ''; 146 }; 147 148 logFormat = mkOption { 149 type = types.str; 150 default = "common"; 151 example = "combined"; 152 description = '' 153 Log format for Apache's log files. Possible values are: combined, common, referer, agent. 154 ''; 155 }; 156 157 robotsEntries = mkOption { 158 type = types.lines; 159 default = ""; 160 example = "Disallow: /foo/"; 161 description = '' 162 Specification of pages to be ignored by web crawlers. See <link 163 xlink:href='http://www.robotstxt.org/'/> for details. 164 ''; 165 }; 166 167}