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

nixos/nix-daemon: Organize buildMachine options with a submodule #83104

Merged
merged 3 commits into from Jul 5, 2020

Conversation

Valodim
Copy link
Contributor

@Valodim Valodim commented Mar 21, 2020

This PR picks up #47636. It changes the nix.buildMachine option from an attribute set to a submodule, with documentations and examples per option.

A couple of thoughts:

  1. The sshKey option is a secret path, which there is no good solution for so far. See Add types.secretPath #78640
  2. There's no assertion to check for presence of both system and systems at the same time, because I couldn't figure out how to do assertions per module nicely :) I guess it's an artifact anyways that there are even two options for this, I'd rather deprecate systems, and type system as str or listOf str, expecting the former to cover basically all cases.
  3. As per this suggestion, I put the features variables an enum, and added an "extra" option that allows freeform features. The idea is to have a somewhat curated list of commonly used names where typos can't happen, and move special ones to their own option.

Ttested this locally, works as expected :)

nixos/modules/services/misc/nix-daemon.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/nix-daemon.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/nix-daemon.nix Outdated Show resolved Hide resolved
@Valodim
Copy link
Contributor Author

Valodim commented Mar 27, 2020

@msteen thanks for the review :) fixed all your points.

I also changed system and systems to default to builtins.currentSystem if neither are set, that seems to be a reasonable default.

@Valodim Valodim requested a review from msteen March 27, 2020 21:31
Copy link
Contributor

@msteen msteen left a comment

Choose a reason for hiding this comment

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

Seems good to me now!

@infinisil infinisil self-requested a review April 14, 2020 12:34
@Ericson2314
Copy link
Member

@Valodim thanks for picking this up for me! And @infinisil, thanks for letting me know.

@Ericson2314
Copy link
Member

Can you add a 20.09 change log breaking change notice?

@Valodim
Copy link
Contributor Author

Valodim commented Jul 5, 2020

I updated this to incorporate all feedback (and rebased on master).

I think we actually ended up compatible with (sane usage of) the previous definitions, at least the config implementation looks identical modulo handling of defaults to me, and the example from the previous documentation produces identical results.

There is a slight potential for errors in configs that used sloppy types before, e.g. a string value for maxJobs will lead to an error like this:

error: The option value 'nix.buildMachines.[definition 1-entry 1].maxJobs' in ... is not of type 'signed integer'.
I added an item to the release notes about that.

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

5 participants