-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
pkgs.formats: Add HOCON format generator #280322
Conversation
4530707
to
dfaadcb
Compare
dfaadcb
to
26489ea
Compare
hi, I have to focus my energy on other things so I won't be participating in this PR. best of luck! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks well thought out, follows an established implementation strategy (see libconfig), has tests, and the Nix code looks good to me.
Although I don't have the opportunity to dive into the intricacies of HOCON, to "definitively" claim that all the details are good, I am confident that this code is maintainable.
60db95e
to
badf956
Compare
Okay, this should be completely ready now. pings for maintainers of affected modules:
|
@ofborg test jitsi-meet prometheus-exporters.jitsi suwayomi-server.with-auth suwayomi-server.without-auth |
badf956
to
b80a61c
Compare
1f7a3c2
to
3735717
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is looking great, I'm impressed by the code quality! Just got some minor suggestions, but I'm happy to merge
3735717
to
421429f
Compare
Found the problem, pushed the fix :D |
This is useful because the tests in `pkgs-lib` can mock out certain `lib` functions like this using a `lib` overlay.
04df819
to
7065951
Compare
Cool! I've reordered and rebased the fixup to make more sense. |
Looking good, let's merge! |
Forgot to mention that this should be documented! See #288163 |
Description of changes
Taking some of the lessons learnt from #246115, I've made a generator for the HOCON format. This generator aims to support (almost) all the features of the HOCON format, including things like substitutions from envvars, different kinds of include statements both for declarative and mutual includes, append statements, etc.
HOCON does not seem to have a definitive governing body, nor a complete formal specification, so I've chosen to base my implementation upon the best I could find: https://github.com/lightbend/config/blob/main/HOCON.md. This means that there's bound to be some compatibility issues with certain implementations (in fact, I've already stumbled upon one with the include types when I tried writing the validator using the most popular go implementation), but I think this is unavoidable to some degree.
Up until now, I've only found these three that are using the program, as well as a pending package. Most of them seem to have copied each others implementation, so backwards compatability can probably be combined:
nixos/modules/services/networking/jitsi-videobridge.nix
nixos/modules/services/networking/jicofo.nix
nixos/modules/services/networking/jibri/default.nix
nixos/modules/services/web-apps/tachidesk-server.nix
(nixos/tachidesk-server: init at 0.7.0 #257733)TODO:
(I think the only thing we'd need to handle would be
__hocon_envvar
and__hocon_unquoted_string
)Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Some tests that now use this generator either directly or indirectly:
Add a 👍 reaction to pull requests you find important.