[Nix-dev] NixOS: Http services

Nicolas Pierron nicolas.b.pierron at gmail.com
Tue Nov 17 19:28:45 CET 2009


Hi list,

Recently, I've made a branch called "httpd-services".  This branch was
used to hack virtual host expression to document their options and to
let them look like modules.  IMHO, the current design has some bad
points:

- virtualHosts = [ {
    serviceType = "trac";
    .. trac options ..
  } ]

- Trac options do not appear inside the generated manual.
- Extra http-services are made using "function" instead of
"serviceType", which is not consistent.
- Duplication between the main host and virtual hosts.

So, I've decided to rewrite this a bit.  The fixed version includes:

- All hosts are contained in services.httpd.hosts.  This option is an
attribute set where each attribute is an host definition.  In
addition, this avoid duplication of options inside the documentation.
- To avoid duplication, when the httpd host is enabled, the main host
is added automatically.  Other host can inherit some properties of the
main host like the admin address.
- serviceType = "<service name>" is replaced by an attribute inside
the host definition.  <service name> = { enable = ..; ... other
options ... }  , thus instead of writting serviceType = <name>, you
write <name>.enable = true; and set the options inside this service
attribute.

service.httpd.hosts = {
  # The host is named.
  hostname = {
     adminAddr = "a.a at a.a";
     .. hostname options ..
     trac = {
       enable = true;
       .. trac options ..
     };
  };
};

- Can be extended from any locations, so zabbix web interface can be
declared in a zabbix directory which contains everything related to
zabbix.

instead of:
modules/services/web-servers/apache-httpd/zabbix.nix

we can have:
modules/services/monitoring/zabbix/web-interface.nix

So, we can have more consistent hierarchy and we can extend services
outside of NixOS while keeping the same writing.  This point make
thing easily integrable inside NixOS.

Integrating this into the main line implies that all users will have
to modify their expressions.  Do you want to get this integrated on
the main line?

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Albert Einstein - Never memorize what you can look up on books.



More information about the nix-dev mailing list