-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Merge container configurations correctly. #17365
Conversation
@layus, thanks for your PR! By analyzing the annotation information on this pull request, we identified @edolstra, @kampfschlaefer and @wavewave to be potential reviewers |
looks fine to me but I have no commit permissions (yet) |
Thanks for looking into this :)
I understand the current code and the code present before that, still the Identically, using Thus, I think the proper solution would be to remove the All, it seems that the |
@nbp Well, config is used by the module system, and also as an option name. I see no conflict as you can access the config option with config.config, right ? eval-config.nix should not be necessary, but is helpful here because it pulls all NixOS modules in the definition of the submodule. How would you do that with All in all, we need your help to understand @shlevy's comment in https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/eval-config.nix#L5-L10, outlining that containers could use types.submodule, but also implying that it is not possible right now. |
Yes, but there is no value at all in calling the module system twice, here. And I think having a {
containers.test-1.config = {
networking.extraHosts = ''
10.10.10.10 bla1
'';
};
} should be equivalent to: {
containers.test-1 = {
networking.extraHosts = ''
10.10.10.10 bla1
'';
};
} for submodules.
All NixOS modules, can be provided to the module system as an option definition in
If
I do understand this comment, and this comment is mostly out of date by the fact that we now have the ability to extend the module system arguments from the |
Just a heads up: to get this into 16.09 it needs to be reviewed, addressed and merged in a few days. |
I'm in favor to include this hotfix as it is, and proper solution in next release |
@domenkozar I agree with @danbst that we should merge it as-is. I have tried to implement a better solution, and it seems to me that the module system needs patching to support recursive use. |
@layus can I ask you to write a changelog entry for this PR? |
An issue arises with container configuration when one defines multiples times the same sub-option, or tries to merge two configuration sets.
For example, only the second extraHost is taken into account in the following setup:
This arises because
config.containers.<name>.config
has no type, and the merge defaults to a dumb//
of the two attributes sets.This pull request moves eval-config.nix earlier in the evaluation process.
This way, eval-config.nix is used to merge configuration settings according to their expected (top-level) definition.
I would love input from @shlevy and @nbp as it seems related to comments they made in the module architecture.
@danbst, This is both an explanation of why your config did not work and a potential fix for your issue described in http://lists.science.uu.nl/pipermail/nix-dev/2016-July/thread.html#20989