nixpkgs/modules/services
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
..
amqp rabbitmq.nix: Set SYS_PREFIX empty so files live in /var 2013-04-19 10:49:46 -04:00
audio Merge hardware.pulseaudio and services.pulseaudio 2013-03-14 23:33:45 +01:00
backup bacula: add ExecReload 2013-05-18 13:29:54 +02:00
databases Increase PostgreSQL's shutdown timeout to 3 minutes 2013-05-07 15:00:36 +02:00
games strip trailing whitespace; no functional change 2011-09-14 18:20:50 +00:00
hardware adding sensor option to thinkfan 2013-05-03 03:28:04 +02:00
logging Don't set $TZ 2013-04-22 18:56:19 +02:00
mail Don't set $TZ 2013-04-22 18:56:19 +02:00
misc Update the default binary cache URL to cache.nixos.org 2013-06-12 14:23:33 +02:00
monitoring zabbix-server: Swap order of database population. 2013-06-13 03:34:29 +02:00
network-filesystems Don't set $TZ 2013-04-22 18:56:19 +02:00
networking openvpn: fix type error 2013-06-04 07:45:58 +02:00
printing Add/fix systemd unit descriptions 2013-01-10 13:59:41 +01:00
scheduling atd: don't enable at daemon by default 2013-06-01 11:39:09 +02:00
security TOR: add obfsproxy support by default for TOR bridges 2013-06-04 13:03:37 +03:00
system nscd: Restart if /etc/hosts changes 2013-06-11 16:15:24 +02:00
torrent transmission: Add apparmor service dependency 2013-05-28 18:00:21 +00:00
ttys agetty: Add 57600 to the baud rate list. 2013-06-14 17:55:37 +02:00
web-servers lighttpd: improve module handling 2013-06-16 13:15:29 +02:00
x11 kde4: use udisks2 for kde versions that support it. 2013-05-17 09:33:00 +02:00