about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2017-07-15 14:08:13 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-07-29 14:24:40 +0200
commitaff0725a7d5171a99ff3baafc04b7cb2aa3722f6 (patch)
treee6801a7f4e8b26c7e2fc20909541ee4dabd8edc4 /nixos/modules
parenta65d8d3af331afd444b20fb2a86ca72dd0c04858 (diff)
downloadnixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar.gz
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar.bz2
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar.lz
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar.xz
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.tar.zst
nixlib-aff0725a7d5171a99ff3baafc04b7cb2aa3722f6.zip
nixos/lighttpd: add enableUpstreamMimeTypes option
enableUpstreamMimeTypes controls whether to include the list of mime
types bundled with lighttpd (upstream). This option is enabled by
default and gives a much more complete mime type list than we currently
have. If you disable this, no mime types will be added by NixOS and you
will have to add your own mime types in services.lighttpd.extraConfig.
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/web-servers/lighttpd/default.nix22
1 files changed, 14 insertions, 8 deletions
diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix
index 151b5ee15203..45a65965112a 100644
--- a/nixos/modules/services/web-servers/lighttpd/default.nix
+++ b/nixos/modules/services/web-servers/lighttpd/default.nix
@@ -89,14 +89,9 @@ let
       accesslog.use-syslog = "enable"
       server.errorlog-use-syslog = "enable"
 
-      mimetype.assign = (
-          ".html" => "text/html",
-          ".htm" => "text/html",
-          ".txt" => "text/plain",
-          ".jpg" => "image/jpeg",
-          ".png" => "image/png",
-          ".css" => "text/css"
-          )
+      ${lib.optionalString cfg.enableUpstreamMimeTypes ''
+      include "${pkgs.lighttpd}/share/lighttpd/doc/config/conf.d/mime.conf"
+      ''}
 
       static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
       index-file.names = ( "index.html" )
@@ -168,6 +163,17 @@ in
         '';
       };
 
+      enableUpstreamMimeTypes = mkOption {
+        type = types.bool;
+        default = true;
+        description = ''
+          Whether to include the list of mime types bundled with lighttpd
+          (upstream). If you disable this, no mime types will be added by
+          NixOS and you will have to add your own mime types in
+          <option>services.lighttpd.extraConfig</option>.
+        '';
+      };
+
       mod_status = mkOption {
         default = false;
         type = types.bool;