-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
nix.conf.json
#8373
Comments
I'm interested in this, too, especially for the Determinate Nix Installer's curing support. We've put together a nix.conf parser in Rust, but we definitely would not mind a more clear configuration format. I'd like to propose we start by saying it is json5, though! |
This would also allow getting rid of |
The problem with json5 is that it would require integrating yet another JSON library, since nlohmann_json does not (and will not) support it: nlohmann/json#150 |
@cole-h we can preprocess it I think and then still use |
Full JSON5 would have been nice, but comments can already be stripped by |
I think it's very important to have a single format, right now there are |
A problem that I see with all the formats: How do we deal with imports? The effect of And as far as I remember, objects/sets/dicts/whatever are unordered in all of JSON, TOML, YAML, and nix. Neither are they able to express the same "key" twice. So even by adding the option " include pre.conf
experimental-features = nix-commands flakes
include post.conf So whatever we do, we might have to consider this when designing the new format, or allow to somehow mix both, such that we keep an old style entrypoint to the configuration, which |
They're also unordered in Nix, so that's fine.
I'd consider that a feature, although we need something for extending/overriding. More on that.
This doesn't strike me as a good format, and overriding is about the least declarative thing, fwiw. We do seem to need a facility for overriding and extending. How about something standard like JSON Patch? As for the syntax, I don't think specifying it in the actual files is really necessary, but we could support that, e.g.: { "include_after": [ "~/.config/nix/nix.conf.json" ],
... some actual items ...
}
|
I would not mind simply not supporting |
This would be very sad, as I use that to be able to set To be honest, I do not care for the "before", "after" or "inmidst" semantics, for me any would be fine, as I do not set |
Is your feature request related to a problem? Please describe.
The config format is a bit fragile. Let's use semi-structured data instead. This enables us to accept more complex settings where it makes sense; for instance a JSON object ("attrset") would be great for configuring individual stores.
Describe the solution you'd like
Allow "nix.conf" to be specified in JSON instead.
nlohmann_json has support for stripping out comments.
No more escaping, no more text parsing, and support for a wider range of values. Great compatibility with the Nix language as well.
Describe alternatives you've considered
Configuration formats like YAML, TOML may be considered. These aren't quite as easy to generate or parse.
YAML is too fragile (Norway problem, etc)
TOML would bias our data model away from composable structures.
Nix is not actually easy to generate from Nix, and needing an evaluator to configure the evaluator would complicate initialization.
Additional context
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: