Conversation
ff812ec to
b1bd085
Compare
b1bd085 to
ce59159
Compare
|
qweered
left a comment
There was a problem hiding this comment.
Approved automatically following the successful run of nixpkgs-review.
roberth
left a comment
There was a problem hiding this comment.
Preliminary review. I've had a look at the overall design, but very little at the implementation.
Testing
This is a lot of intricate code, so it needs tests.
You can add them in lib/tests.
A basic test strategy would be to use lib/tests/misc.nix, but for really good coverage, you could generate pairs of RON and expected parsed Nix values with a Rust program. (rnix, or just go via JSON).
Documentation
Format lgtm overall, but the new sublibrary needs to be added in doc/doc-support/lib-function-docs.nix.
Not sure if we have something for an introductory section to lay out the in-Nix format, but I guess toRON could just refer to fromRON to achieve something similar.
| - Maps: `{ _type = "ron-map"; value = [{ key = ...; value = ...; }, ...]; }` | ||
| - Named structs: `{ _type = "ron-named-struct"; name = "..."; value = { ... }; }` | ||
| - Tuples: `{ _type = "ron-tuple"; value = [...]; }` | ||
| - Raw values: `{ _type = "ron-raw"; value = "..."; }` |
There was a problem hiding this comment.
This needs introduction, but should it even be generated by the parser?
There was a problem hiding this comment.
I improved the documentation for the raw type to cover its uses.
Regarding your question, the parser generates raw values to prevent data loss on high-precision floats and to handle unsupported syntax without crashing.
The raw type is also useful when generating RON with toRON, as it allows a user to inject a pre-formatted raw string. This offers more flexibility for complex values or for syntax the builder doesn't support (which currently doesn't happen).
Similarly to:
Lines 885 to 888 in 7e246f7
For me, it seems like a valuable feature. I'm open to other ideas if you have a different approach in mind.
ce59159 to
8cd071e
Compare
8cd071e to
70f1512
Compare
537a5c9 to
493e8d2
Compare
493e8d2 to
9a9cbe6
Compare
|
Thanks for the effort to upstream this, @HeitorAugustoLN! I had a small request (can be done in a followup PR): Could this new generator also be added to Is there anything pending on this PR? I'd like to use this feature soon. |
It is already done in #442207 |
|
Nice! Thanks! |
Adds functions for parsing and generating RON (Rusty Object Notation) data.
9a9cbe6 to
5397743
Compare
|
It would be really nice, if something of the merge process would unblock this. This is the starting point of a merge-request series to bring in nixos home-manager automated theming of cattpuccin for cosmic desktop environment. I am really missing this, since every other component is properly themed already. |
|
I too think it should be in nixpkgs! I made ronix without knowing this was in progress! Anyway I think ronix can still be used for mapping ron files to nix configurations, very useful for migration! |
Adds functions for parsing and generating RON (Rusty Object Notation) data.
Basically upstreaming some functions from cosmic-manager, for use in nixpkgs (system-wide COSMIC configurations, upstream some modules to home-manager, other modules, etc.), asked by some users in HeitorAugustoLN/cosmic-manager#34.
Option types for ron will be done in a follow-up PR
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.