3
0
Fork 0
forked from mirrors/nixpkgs

nixos/nginx: add defaultMimeTypes option

This commit is contained in:
Izorkin 2023-01-05 18:51:59 +03:00
parent bdfa4d2e95
commit 5eb5d881a4
No known key found for this signature in database
GPG key ID: 1436C1B3F3679F09

View file

@ -112,10 +112,8 @@ let
'')); ''));
commonHttpConfig = '' commonHttpConfig = ''
# The mime type definitions included with nginx are very incomplete, so # Load mime types.
# we use a list of mime types from the mailcap package, which is also include ${cfg.defaultMimeTypes};
# used by most other Linux distributions by default.
include ${pkgs.mailcap}/etc/nginx/mime.types;
# When recommendedOptimisation is disabled nginx fails to start because the mailmap mime.types database # When recommendedOptimisation is disabled nginx fails to start because the mailmap mime.types database
# contains 1026 entries and the default is only 1024. Setting to a higher number to remove the need to # contains 1026 entries and the default is only 1024. Setting to a higher number to remove the need to
# overwrite it because nginx does not allow duplicated settings. # overwrite it because nginx does not allow duplicated settings.
@ -529,6 +527,18 @@ in
''; '';
}; };
defaultMimeTypes = mkOption {
type = types.path;
default = "${pkgs.mailcap}/etc/nginx/mime.types";
defaultText = literalExpression "$''{pkgs.mailcap}/etc/nginx/mime.types";
example = literalExpression "$''{pkgs.nginx}/conf/mime.types";
description = lib.mdDoc ''
Default MIME types for NGINX, as MIME types definitions from NGINX are very incomplete,
we use by default the ones bundled in the mailcap package, used by most of the other
Linux distributions.
'';
};
package = mkOption { package = mkOption {
default = pkgs.nginxStable; default = pkgs.nginxStable;
defaultText = literalExpression "pkgs.nginxStable"; defaultText = literalExpression "pkgs.nginxStable";