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/eval/Cargo.toml | |
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/eval/Cargo.toml')
-rw-r--r-- | tvix/eval/Cargo.toml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tvix/eval/Cargo.toml b/tvix/eval/Cargo.toml index d1bb48a7c512..d347d0ea687a 100644 --- a/tvix/eval/Cargo.toml +++ b/tvix/eval/Cargo.toml @@ -16,6 +16,7 @@ codemap-diagnostic = "0.1.1" dirs = "4.0.0" genawaiter = { version = "0.99.1", default_features = false } imbl = { version = "2.0", features = [ "serde" ] } +itertools = "0.12.0" lazy_static = "1.4.0" lexical-core = { version = "0.8.5", features = ["format", "parse-floats"] } path-clean = "0.1" |