-
Notifications
You must be signed in to change notification settings - Fork 10
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
YAML for config #343
Comments
Oh well NixOS/nix#7340 |
What do we use to parse YAML in rust? I see three options:
|
I'd use A maintained fork may popup later (there's one already but not ready yet: cafkafk/serde-norway#17). There's also https://github.com/saphyr-rs/saphyr but |
Also, what's the problem with using json for configs instead? |
Not a problem per se, but the UX of editing the config can suck a bit. https://x.com/i/grok/share/eulnfhBsYG4zrqRX3U96yU9Q6 For eg., multiline-strings will look like this in JSON (forced to be single line, peppered with TOML is another option, but nested attrs will look pretty verbose: Do you think we should simply go with JSON instead? |
re YAML, more options are listed at rustsec/advisory-db#2132 . https://crates.io/crates/serde_yml doesnt use |
Basic benchmark of fetching Timer precision: 41 ns
config fastest │ slowest │ median │ mean │ samples │ iters
├─ from_flake_url 156.5 ms │ 346.5 ms │ 173.9 ms │ 176.2 ms │ 100 │ 100
├─ from_json 26.16 µs │ 146.4 µs │ 29.54 µs │ 31.53 µs │ 100 │ 100
╰─ from_yaml 110.4 µs │ 478.3 µs │ 115.3 µs │ 125.5 µs │ 100 │ 100 Edit: I’m not sure if we’d want to include these benchmarks in Edit: I’ll also be adding YAML to this soon. Edit: The benchmark now includes YAML too |
This would mitigate #339
Our entire omnix configuration (
om.nix
),https://github.com/juspay/omnix/blob/main/nix/modules/flake-parts/om.nix
can be written as YAML as well (see below). This has the benefit of not needing to evaluate the whole flake just to get the omnix config. This would then make
om develop
faster.We may still have to support Nix-based config (but that piggyback on YAML using
builtins.fromYAML
) for cases where we evaluate a non-local flake (even then we can catch the flake in local nix store before looking up YAML, falling back to Nix eval).Blocked on #341 (after which doing this should be straightforward).
The text was updated successfully, but these errors were encountered: