[Nix-dev] Multiple MySQL instances (or nginx/apache/...)

Luca Bruno lethalman88 at gmail.com
Sat Jan 3 14:27:47 CET 2015


Let's not break the discussion in two places. It started on the github
issue and can be kept there.

On Sat, Jan 3, 2015 at 2:23 PM, Marc Weber <marco-oweber at gmx.de> wrote:

> How should this be written in the future ?
>
> I've submitted a pull request which tries to change not much lines to
> reach my goal - however I agree that it might not be the perfect
> solution yet: https://github.com/NixOS/nixpkgs/pull/5542
>
> This change adds a parameter moduleName to the mysql module which then
> gets used for most defaults (pid file, data dir and so on)
>
>     { moduleName ? "mysql"}: # eg pass mysql2 to add a second mysql
>
>         services.${moduleName} = {
>
>            enable = mkOption {
>              default = false;
>            };
>
>            user = mkOption {
>              default = moduleName;
>     [...]
>
>
> Final usage look like this:
>
>    imports = [
>         (import (<nixpkgs>+"/nixos/modules/services/databases/mysql.nix")
> {moduleName = "mysql_on_tmp"; })
>     ]
>
>     services.mysql_on_tmp.enable = true;
>     services.mysql_on_tmp.port = 3307;
>     services.mysql_on_tmp.package = pkgs.mysql55;
>     services.mysql_on_tmp.dataDir = "/tmp/mysql";
>     services.mysql_on_tmp.socketDir = "/tmp/mysql_tmpfs.socket";
>
>     ids.uids.mysql_on_tmp = 20000;
>     ids.gids.mysql_on_tmp = 20000;
>
>
>
> If there are existing beter solutions let me know and or comment to
> either the pull request or this thread.
>
>
> I guess the most interesting point is uid/gid handling.
>
> Introducing a style will affect almost all services ..
>
>
> lethalman proposes such style:
>
>   services.mysql.instances.<name> = ...
>
> I agree that this style is nicer. Do you agree?
> Should services.mysql be mapped to services.mysql.instances.default then?
> Then backward compatibility could be preserved.
>
> Marc Weber
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>



-- 
NixOS Linux <http://nixos.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150103/b83fac98/attachment.html 


More information about the nix-dev mailing list