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

Make nix.conf changes deterministic #620

Merged
merged 10 commits into from Sep 13, 2023
Merged

Conversation

Hoverbear
Copy link
Contributor

@Hoverbear Hoverbear commented Sep 1, 2023

Description

Removes nix-config-parser.

Uses an !include ./defaults.conf to include some defaults file which we control precisely in both content and order.

Only manipulates the first line which is not a comment in nix.conf, or creates the file.

Does a bit of rudimentary scanning of the file for possible conflicts, and warn if so.

Note: More testing to be done, though manual testing indicates it works well-ish.

Should address #562

Checklist
  • Formatted with cargo fmt
  • Built with nix build
  • Ran flake checks with nix flake check
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)
Validating with install.determinate.systems

If a maintainer has added the upload to s3 label to this PR, it will become available for installation via install.determinate.systems:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/$PR_NUMBER | sh -s -- install

@Hoverbear Hoverbear added this to the 0.11.1 milestone Sep 1, 2023
@Hoverbear Hoverbear self-assigned this Sep 1, 2023
@Hoverbear Hoverbear added the upload to s3 The labeled PR is allowed to upload its artifacts to S3 for easy testing label Sep 1, 2023
@Hoverbear Hoverbear marked this pull request as ready for review September 5, 2023 18:33
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
src/action/common/place_nix_configuration.rs Outdated Show resolved Hide resolved
if defaults_conf_setting.0.trim() == *existing_field
&& defaults_conf_setting.1.trim() != existing_value.trim()
{
tracing::warn!("Found existing `/etc/nix/nix.conf` setting `{existing_field} = {existing_value}` which will override a default setting from the `nix-installer`, consider unsetting it. For settings like `experimental-features` you can use an `extra-*` prefix to append to the defaults")
Copy link
Member

Choose a reason for hiding this comment

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

nit:

This isn't necessarily true if they used an include statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True but I didn't really want to implement full tracking on where we include various settings from. If you think it's important, let's do it, otherwise I just wanted to keep the code simpler. It's my impression most people will see an error like this and go "Oh, that's an old install" and simply blow away the /etc/nix folder.

src/action/mod.rs Outdated Show resolved Hide resolved
@Hoverbear
Copy link
Contributor Author

I did a full VM test run and it passed, so that gives me some confidence this won't cause breakage.

src/action/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

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

🎉

@Hoverbear Hoverbear enabled auto-merge (squash) September 13, 2023 16:53
@Hoverbear Hoverbear merged commit 05571a4 into main Sep 13, 2023
12 of 13 checks passed
@Hoverbear Hoverbear deleted the make-nix-conf-deterministic branch September 13, 2023 17:02
@Hoverbear
Copy link
Contributor Author

Looks like we're gonna revert this and try something different. We saw an elevated rate of failures resulting from this ticket and reflecting some members of the team preferred the old merge method.

Hoverbear added a commit that referenced this pull request Sep 28, 2023
Hoverbear added a commit that referenced this pull request Sep 28, 2023
* Revert "Make nix.conf changes deterministic (#620)"

This reverts commit 05571a4.

* fmt

* Prod ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upload to s3 The labeled PR is allowed to upload its artifacts to S3 for easy testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants