nixos/nginx: use mailcap 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.
This commit is contained in:
Milan Pässler 2019-08-27 15:10:26 +02:00 committed by Alyssa Ross
parent 015e3edd24
commit ff0148d868
2 changed files with 7 additions and 2 deletions

View file

@ -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;

View file

@ -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
'';