nixos/lighttpd: add enableUpstreamMimeTypes option

enableUpstreamMimeTypes controls whether to include the list of mime
types bundled with lighttpd (upstream). This option is enabled by
default and gives a much more complete mime type list than we currently
have. If you disable this, no mime types will be added by NixOS and you
will have to add your own mime types in services.lighttpd.extraConfig.

Changed files
+14 -8
nixos
modules
services
web-servers
lighttpd
+14 -8
nixos/modules/services/web-servers/lighttpd/default.nix
···
accesslog.use-syslog = "enable"
server.errorlog-use-syslog = "enable"
-
mimetype.assign = (
-
".html" => "text/html",
-
".htm" => "text/html",
-
".txt" => "text/plain",
-
".jpg" => "image/jpeg",
-
".png" => "image/png",
-
".css" => "text/css"
-
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
···
want to add custom stuff to
<option>services.lighttpd.extraConfig</option> that depends on a
certain module.
'';
};
···
accesslog.use-syslog = "enable"
server.errorlog-use-syslog = "enable"
+
${lib.optionalString cfg.enableUpstreamMimeTypes ''
+
include "${pkgs.lighttpd}/share/lighttpd/doc/config/conf.d/mime.conf"
+
''}
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
···
want to add custom stuff to
<option>services.lighttpd.extraConfig</option> that depends on a
certain module.
+
'';
+
};
+
+
enableUpstreamMimeTypes = mkOption {
+
type = types.bool;
+
default = true;
+
description = ''
+
Whether to include the list of mime types bundled with lighttpd
+
(upstream). If you disable this, no mime types will be added by
+
NixOS and you will have to add your own mime types in
+
<option>services.lighttpd.extraConfig</option>.
'';
};