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

Implement a interface-like system #3

Open
MagicRB opened this issue Nov 18, 2021 · 2 comments
Open

Implement a interface-like system #3

MagicRB opened this issue Nov 18, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@MagicRB
Copy link
Collaborator

MagicRB commented Nov 18, 2021

Some options are commonly shared between different services. For example:

{
  # ...
  envsubst = {
    enable = mkEnableOption "Enable envsubst";
  
    variables = mkOption {
      type = with types; attrsOf (oneOf [ string int bool ]);
      # ...
    };
  };
  # ...
}

These options should be available for all services, but they should be implemented differently, each service has different config files. The next step may be making a system where the environmental substitution of configuration files is delegated to a common implementation, so that one can rely on original config files being in /run/<service-name>/orig and the modified version being in /run/<service-name>/subst.

Another example may be "user-group" handling, almost all services have a user and group options. The semantics of these options are not well defined, while I personally try to adhere to some semantics, it would be best if this was formalized in an implementation external to individual modules.

@MagicRB MagicRB added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Nov 18, 2021
@Atry
Copy link

Atry commented May 1, 2024

I think the common interface can be implemented in lib.types.deferredModule since NixOS/nixpkgs#163617

@MagicRB
Copy link
Collaborator Author

MagicRB commented May 2, 2024

Indeed, the problem is deciding what to make default and precisely how it should work :) but thanks for the pointer deferredSubmodule will be useful for another thing im working on. I didn't know abiut that type somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants