-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: add support for nix.conf include directives #681
feat: add support for nix.conf include directives #681
Conversation
Implement parsing and resolution of include/!include directives in nix.conf files to support setups like determinate nix installer that split configs across multiple files. Key features: - Support both required (include) and optional (!include) directives - Detect and prevent circular includes - Resolve paths relative to including file - Maintain existing error handling patterns This allows Cachix to properly read trusted-users and other settings from included config files.
c1ce54b
to
f866fde
Compare
The parsing bits look good to me. I added tests for those and ran the formatters over the code. There are still some minor issues with variable shadowing. The main problem is the write-back function. If we flatten all of the includes into a single I haven't given this much thought yet. Perhaps we should use our own |
Thanks for giving this a view! If I understand correctly, the write function is only used for writing our own configuration changes, not modifying the user's existing config files. In that case, flattening should be fine since we're not trying to preserve/modify the original include structure. Would you confirm that's the intended behavior of the write function? If so, I think the current flattening approach should work well for our needs. Questions I have:
|
[moved to #680, since that is the overall issue] |
It very much modifies the existing config files in-place. I've worked out an interim solution for the writes: https://github.com/cachix/cachix/compare/nix-conf-fix?expand=1 @domenkozar and I will review tomorrow morning (it's quite late here), likely apply the above changes on top, and start propagating a release. |
Implement parsing and resolution of include/!include directives in nix.conf files to support setups like determinate nix installer that split configs across multiple files.
Key features:
Implementation details:
Following the nix.conf specification:
include
) error if file not found!include
) continue silently if file missingThis allows Cachix to properly read trusted-users and other settings from included config files.
I'm new to Haskell, so I'd really appreciate feedback on the implementation approach. Happy to adjust based on your input!
Related issue: #680