Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple services #9

Closed
srid opened this issue Jul 3, 2023 · 2 comments · Fixed by #13
Closed

Multiple services #9

srid opened this issue Jul 3, 2023 · 2 comments · Fixed by #13

Comments

@srid
Copy link
Member

srid commented Jul 3, 2023

cf. "This also solves the problem of only being able to run one instance at a time." of cachix/devenv#75

Consider this scenario

passetto adds a postgresql service. But the user (nammayatri) may add their own postgresql service. Can the two DB coexist?

What we can do

Should we adjust the module API to accomodate for this? For eg., instead of:

services.postgresql.enable = true;

do we instead do:

services.postgresql."some-name".enable = true;

And consistently use this API for all services?

Concrete goal

This should work in nammayatri which has its own postgresql, as well as a postgres db used for passeto.

@shivaraj-bh
Copy link
Member

shivaraj-bh commented Jul 3, 2023

This makes sense! I think we can already do this if we have a different dataDir and serve on a different port.

@srid
Copy link
Member Author

srid commented Jul 3, 2023

It would look more like this,

services.postgresql = lib.mkOption {
  type = types.submodule ({name, ...}: {
    options = {
      dataDir = lib.mkOption {
        type = types.str;
        default = "./data/${name}";
      };
    }
  });
}

Note how dataDir's default is determined from the attrset key (name).

@shivaraj-bh shivaraj-bh mentioned this issue Jul 5, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants