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

Moritz Ulrich moritz at tarn-vedra.de
Sun Jan 18 12:55:07 CET 2015

Marc Weber <marco-oweber at gmx.de> writes:

> 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.
> 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.
> Thus does anybody just spot what I'm doing wrong?
> If we are at it: Eelco Dolstra proposed "services.mysql.services" or
> such. 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.
> Marc Weber
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

I really like this idea.

Another use that comes to mind is using it to open ports in the firewall
in a declarative manner. E.g.:

firewall.allowedTCPPorts = [
] ++ resources.mysql.tcpPorts 
  ++ resources.httpd.tcpPorts;

(Assuming it uses a list of ports as suggested in my other reply.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150118/7cd298da/attachment.bin 

More information about the nix-dev mailing list