Introduce top-level structuredAttrs field in JSON derivation format#13349
Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom Jun 18, 2025
Merged
Introduce top-level structuredAttrs field in JSON derivation format#13349Ericson2314 merged 1 commit intoNixOS:masterfrom
structuredAttrs field in JSON derivation format#13349Ericson2314 merged 1 commit intoNixOS:masterfrom
Conversation
Makes the behavoral change of NixOS#13263 without the underlying refactor. Hopefully this clearly safe from a perf and GC perspective, and will make it easier to benchmark NixOS#13263.
23b9b16 to
f8c1ac9
Compare
edolstra
approved these changes
Jun 18, 2025
| res["env"] = env; | ||
|
|
||
| if (auto it = env.find("__json"); it != env.end()) { | ||
| res["env"].erase("__json"); |
Member
There was a problem hiding this comment.
Suggested change
| res["env"].erase("__json"); | |
| res["env"].erase(it); |
Member
Author
There was a problem hiding this comment.
Can't do this, because the iterator is for env, but we're deleting in res["env"].
Member
Author
There was a problem hiding this comment.
I missed that when reading now too :). Only noticed after I got the compiler error.
| auto envJson = valueAt(json, "env"); | ||
| try { | ||
| res.env = getStringMap(envJson); | ||
| } catch (Error & e) { |
Member
There was a problem hiding this comment.
Why does it catch exceptions for env specifically? (And not for any of the other attributes.)
Member
Author
There was a problem hiding this comment.
It probably should do this for all of these, to the extent that we care about nice errors. There might be a closure-based way to do this more tersely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Arguably progress on #9866
Context
Makes the behavoral change of #13263 without the underlying refactor. Hopefully this clearly safe from a perf and GC perspective, and will make it easier to benchmark #13263.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.