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

lib/types: change merge strategy for str, int, float, path and enum #65380

Merged
merged 1 commit into from Jul 29, 2019

Conversation

danbst
Copy link
Contributor

@danbst danbst commented Jul 25, 2019

Change to mergeEqualOption, to improve mergeability of modules.

Without this, we have a conflict:

$ nix-instantiate nixos --arg configuration '{ lib, config, ...}: { 
    boot.isContainer = true;
    imports = [ 
       { services.postgresql.enable = true; } 
       { users.users.postgres.uid = config.ids.uids.postgres; }  
    ]; }' -A system
error: The unique option `users.users.postgres.uid' is defined multiple times, in:
 - /home/danbst/dev/nixpkgs/nixos/modules/services/databases/postgresql.nix
 - <unknown-file>.

Usually, it is enough to mkOverride 1001 or mkDefault to overcome this limitation, but I wonder why was that restrictive merge strategy used.

cc @nbp @edolstra

@danbst danbst requested review from edolstra and nbp as code owners July 25, 2019 15:29
@danbst
Copy link
Contributor Author

danbst commented Jul 25, 2019

This was triggered by #63799 (comment)

@Mic92 Mic92 requested a review from infinisil July 26, 2019 12:45
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking through the git logs, I couldn't find any technical reason for this. However, mergeOneOption has existed longer than mergeEqualOption, which was introduced only in e212e07. So it's probably just that @edolstra didn't think of using it for more types than bool.

Also pinging @Profpatsch, but this looks good to me

@Profpatsch
Copy link
Member

Does it make sense for floats?

@infinisil
Copy link
Member

@Profpatsch It's probably fine, we're not using floats for any numerical calculations

@infinisil infinisil merged commit 377cd8a into NixOS:master Jul 29, 2019
@danbst danbst deleted the int-merge-one-option branch July 30, 2019 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants