Skip to content

Commit

Permalink
nixos/nginx: use mailcap mime.types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Milan Pässler authored and alyssais committed Oct 9, 2019
1 parent 015e3ed commit ff0148d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion nixos/modules/services/web-servers/nginx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion pkgs/data/misc/mailcap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
Expand Down

0 comments on commit ff0148d

Please sign in to comment.