nixos/nginx: add defaultMimeTypes option

This commit is contained in:
Izorkin
2023-03-07 19:37:18 +03:00
parent bdfa4d2e95
commit 5eb5d881a4
@@ -112,10 +112,8 @@ let
''));
commonHttpConfig = ''
# The mime type definitions included with nginx are very incomplete, so
# we use a list of mime types from the mailcap package, which is also
# used by most other Linux distributions by default.
include ${pkgs.mailcap}/etc/nginx/mime.types;
# Load mime types.
include ${cfg.defaultMimeTypes};
# 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
# 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 {
default = pkgs.nginxStable;
defaultText = literalExpression "pkgs.nginxStable";