[Nix-dev] Multiple instances - detecting resource collisions - nixos module system question

Nicolas Pierron nicolas.b.pierron at gmail.com
Thu Jan 15 01:23:24 CET 2015

On Wed, Jan 14, 2015 at 11:17 PM, Marc Weber <marco-oweber at gmx.de> wrote:
> If you use multiple apaches/nginx/mysql/postgresql/whatever instances
> its likely to miss adjusting the port or whatsoever. Therefore I'd like
> to implement a simple "resource tracking" module which fails if a
> resource such as tcp/ip port or socket or such gets used multiple times.

This is awesome!

> It should look like this: http://dpaste.com/10RKJSQ
> A test like this:
>        resources.tcp-ports."80" = {};
> causes:
>   The option `resources.tcp-ports.80.allowCollisions' defined in `/etc/nixos/nixpkgs/nixos/modules/misc/resources.nix' does not exist.
> which I don't get because the dpaste sets a default value for
> allowCollisions.

Apparently, the submodules are no longer option sets by default, so
you should wrap the options under an "options = { … };"  attribute.

> If we are at it: Eelco Dolstra proposed "services.mysql.services" or
> such.

I would prefer "services.mysql.instances.<name>".  These is what httpd
does with virtual hosts.

> What about services.mysqls ? We could deprecade services.mysql
> then and ask users to switch slowly. No naming collisions. Naming is
> short and could be adopted to other services.

the "s" is shorter than ".instances" or ".services", but it might be
confusing & typo friendly.

Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/

More information about the nix-dev mailing list