diff options
author | Ryan Lahfa <tvl@lahfa.xyz> | 2024-01-14T01·40+0100 |
---|---|---|
committer | raitobezarius <tvl@lahfa.xyz> | 2024-01-17T17·25+0000 |
commit | 75cc52ddb136e66b1a79117425fb35f80dcecc07 (patch) | |
tree | 57677ca5bac9beb1d4b102d831a76e772b4bb9da /tvix/serde | |
parent | 5e67b94704e601d7f787f4e75c66f6cd07ee13c2 (diff) |
fix(tvix/eval): `getContext` merges underlying values r/7403
Previously, we were assembling very naively an attribute set composed of context we saw. But it was forgetting that `"${drv}${drv.drvPath}"` would contain 2 contexts with the same key, but with different values, one with `outputs = [ "out" ];` and `allOutputs = true;`. Following this reasoning and comparing with what Nix does, we ought to merge underlying values systematically. Hence, I bring `itertools` to perform a group by on the key and merge everything on the fly, it's not beautiful but it's the best I could find, notice that I don't use `group_by` but I talk about group by, that is, because `group_by` is a `group_by_consecutive`, see https://github.com/rust-itertools/itertools/issues/374. Initially, I tried to do it without a `into_grouping_map_by`, it was akin to assemble the final `NixAttrs` directly, it was less readable and harder to pull out because we don't have a lot of in-place mutable functions on our data structures. Change-Id: I9933c9bd88ffe04de50dda14f21879b60d8b8cd4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10620 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/serde')
0 files changed, 0 insertions, 0 deletions