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

checks: check /etc/nix/nix.custom.conf hash #1266

Merged
merged 2 commits into from
Jan 18, 2025

Conversation

emilazy
Copy link
Collaborator

@emilazy emilazy commented Jan 13, 2025

After DeterminateSystems/nix-installer#1379, the Determinate Systems installer will write custom user configuration to nix.custom.conf and include it from nix.conf. We need to check for its presence and error out if it contains any settings so as to not inadvertently clobber user configuration. The error message here could maybe be improved but it’s better than not handling it at all.

Drafted until that PR is ready to ship and we know what the hash of the nix.conf and empty nix.custom.conf will be.

This should land before #1259 if it’s ready in time, or else get backported.


Note: This work was funded by Determinate Systems. The design is my own.

# Generated by https://github.com/DeterminateSystems/nix-installer.
# See `/nix/nix-installer --version` for the version details.

!include nix.custom.conf
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be at the bottom to be able to override their defaults?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably, yeah. This is what’s shipped in the wild in v0.33.0, though, so I think we have to handle this version of the file anyway.

@emilazy
Copy link
Collaborator Author

emilazy commented Jan 14, 2025

A new version with the relevant PR has been released; I’ve tested the code and fixed it to use etcChecks and a separate removal step (curse you, user activation). It handles both the stock file and user customizations correctly.

@emilazy emilazy marked this pull request as ready for review January 14, 2025 23:46
@emilazy emilazy force-pushed the push-qwtkyltnunqn branch 2 times, most recently from f9eefa6 to edee959 Compare January 16, 2025 21:30
@emilazy
Copy link
Collaborator Author

emilazy commented Jan 16, 2025

Updated for the new hashes in v0.34.0; confirmed that it still works.

Enzime
Enzime previously approved these changes Jan 17, 2025
Copy link
Collaborator

@Enzime Enzime left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -823,8 +823,58 @@ in
]);
users.knownGroups = mkIf cfg.configureBuildUsers [ "nixbld" ];

# The Determinate Systems installer puts user‐specified settings in
# `/etc/nix/nix.custom.conf` since vX.YY.Z. Supplement the
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing this is meant to have an actual version number

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Whoops, fixed.

@emilazy emilazy merged commit 87131f5 into LnL7:master Jan 18, 2025
3 checks passed
@emilazy emilazy deleted the push-qwtkyltnunqn branch January 18, 2025 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants