3
0
Fork 0
forked from mirrors/nixpkgs
Nix Packages collection
Go to file
Bjørn Forsman 8c3264466a lighttpd: improve module handling
lighttpd doesn't support loading a module more than once. If you attempt
to load a module again, lighttpd prints an error message:

  (plugin.c.131) Cannot load plugin mod_cgi more than once, please fix your config (we may not accept such configs in future releases

And it's not just the error message. The module isn't loaded (or is
messed up somehow) so that neither sub-service will work properly after
this.

This is bad news for the current approach to sub-services, where each
sub-service lists the needed modules in a server.modules += (...) block.
When two sub-services need the same module we get the above issue. (And,
AFAIK, there is no way to check if a module is already loaded either.)

First I thought about an approach where each sub-service specifies the
list of plugins it needs, and that a common server.modules = (...) list
is built from the union of those lists. That would loosly couple the
sub-services with the main lighttpd nixos module expression. But I think
this is a bad idea because lighttpd module loading order matters[1], and
the module order in the global server.modules = (...) list would be
somewhat cumbersome to control.

Here is an example:

Sub-service A needs mod_fastcgi. Sub-service B needs mod_auth and
mod_fastcgi. Note that mod_auth must be loaded *before* mod_fastcgi to
take effect. The union of those modules may either be ["mod_auth"
"mod_fastcgi"] or ["mod_fastcgi" "mod_auth"] depending on the evaluation
order. The first order will work, the latter will not.

So instead of the above, this commit moves the modules from
service.modules += (...) snippets in each sub-service to a global
server.modules = (...) list in the main lighttpd module expression. The
module loading order is fixed and each module is included only if any of
the sub-services that needs it is enabled.

The downside to this approach is that sub-services need a (tiny) bit of
change to the main lighttpd nixos module expression. But I think it is
the only sane way to do it (as long as lighttpd is written the way it
is).

References:
  [1] http://redmine.lighttpd.net/projects/1/wiki/Server_modulesDetails
  [2] http://redmine.lighttpd.net/issues/2337
2013-06-16 13:15:29 +02:00
doc Manual: "mke2fs -j" -> mkfs.ext4 2013-05-13 11:54:04 +02:00
gui renaming all occurrences of /var/run/{booted,current}-system 2012-07-23 14:01:35 -04:00
lib Fix tree toggles in VM tests 2013-06-14 13:50:00 +02:00
maintainers Update to use NixOps in stead on charon, use copy_image method for copying to other regions. 2013-06-05 18:12:20 +02:00
modules lighttpd: improve module handling 2013-06-16 13:15:29 +02:00
tests Fix the installer test 2013-06-14 14:04:17 +02:00
.gitignore Ignore .version-suffix file created by nixos-rebuild 2013-01-16 10:12:42 -05:00
.version Bump the NixOS version number to 0.2 2013-01-15 14:25:13 +01:00
COPYING * Add a license, finally :-) 2010-05-28 11:48:41 +00:00
default.nix Parameterise the path to nixpkgs. 2013-01-28 16:11:44 +01:00
README * URL updates. 2008-05-09 15:08:43 +00:00
release-combined.nix release-combined: Remove maintainers from everything but `tested' 2013-04-05 13:59:43 -04:00
release.nix iso_minimal_new_kernel 2013-04-06 18:24:50 +02:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
http://nixos.org/nixos and in the manual in doc/manual.