mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Ensure that attrsets are sorted
Previously you had to remember to call value->attrs->sort() after populating value->attrs. Now there is a BindingsBuilder helper that wraps Bindings and ensures that sort() is called before you can use it.
This commit is contained in:
parent
1ffacad8a5
commit
6d9a6d2cc3
17 changed files with 260 additions and 198 deletions
|
@ -258,13 +258,10 @@ static void main_nix_build(int argc, char * * argv)
|
|||
auto autoArgs = myArgs.getAutoArgs(*state);
|
||||
|
||||
if (runEnv) {
|
||||
auto newArgs = state->allocBindings(autoArgs->size() + 1);
|
||||
auto tru = state->allocValue();
|
||||
mkBool(*tru, true);
|
||||
newArgs->push_back(Attr(state->symbols.create("inNixShell"), tru));
|
||||
for (auto & i : *autoArgs) newArgs->push_back(i);
|
||||
newArgs->sort();
|
||||
autoArgs = newArgs;
|
||||
auto newArgs = state->buildBindings(autoArgs->size() + 1);
|
||||
newArgs.alloc("inNixShell").mkBool(true);
|
||||
for (auto & i : *autoArgs) newArgs.insert(i);
|
||||
autoArgs = newArgs.finish();
|
||||
}
|
||||
|
||||
if (packages) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue