diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index e597f34700ae..ae769694f6bd 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -61,7 +61,10 @@ let ${optionalString (cfg.httpConfig == "" && cfg.config == "") '' http { - include ${cfg.package}/conf/mime.types; + # 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; include ${cfg.package}/conf/fastcgi.conf; include ${cfg.package}/conf/uwsgi_params; diff --git a/pkgs/data/misc/mailcap/default.nix b/pkgs/data/misc/mailcap/default.nix index d27e1d2dfd2e..725d4ded0eba 100644 --- a/pkgs/data/misc/mailcap/default.nix +++ b/pkgs/data/misc/mailcap/default.nix @@ -7,13 +7,15 @@ in fetchzip { name = "mailcap-${version}"; url = "https://releases.pagure.org/mailcap/mailcap-${version}.tar.xz"; - sha256 = "0m1rls4z85aby9fggwx2x70b4y6l0jjyiqdv30p8g91nv8hrq9fw"; + sha256 = "08d0avz8971hkggd60dk9yyd14izz24yag3prpfafbvm670jlmqg"; postFetch = '' tar -xavf $downloadedFile --strip-components=1 substituteInPlace mailcap --replace "/usr/bin/" "" gzip mailcap.4 + sh generate-nginx-mimetypes.sh < mime.types > nginx-mime.types + install -D -m0644 nginx-mime.types $out/etc/nginx/mime.types install -D -m0644 -t $out/etc mailcap mime.types install -D -m0644 -t $out/share/man/man4 mailcap.4.gz '';