aboutsummaryrefslogtreecommitdiff
path: root/src/nix/bundle.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-01-04 17:39:16 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-01-04 18:00:33 +0100
commit6d9a6d2cc3a20c9047436d174c9f91a2223da220 (patch)
tree2bf36cb443a80f56db38e10c8afe2c749ff3bdcc /src/nix/bundle.cc
parent1ffacad8a5201713659d5e18db47b2020bdc6aa1 (diff)
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.
Diffstat (limited to 'src/nix/bundle.cc')
-rw-r--r--src/nix/bundle.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc
index aca024bca..adb5b3e73 100644
--- a/src/nix/bundle.cc
+++ b/src/nix/bundle.cc
@@ -78,20 +78,20 @@ struct CmdBundle : InstallableCommand
Strings{bundlerName == "" ? "defaultBundler" : bundlerName},
Strings({"bundlers."}), lockFlags);
- Value * arg = evalState->allocValue();
- evalState->mkAttrs(*arg, 2);
+ auto attrs = evalState->buildBindings(2);
PathSet context;
for (auto & i : app.context)
context.insert("=" + store->printStorePath(i.path));
- mkString(*evalState->allocAttr(*arg, evalState->symbols.create("program")), app.program, context);
+ attrs.alloc("program").mkString(app.program, context);
- mkString(*evalState->allocAttr(*arg, evalState->symbols.create("system")), settings.thisSystem.get());
-
- arg->attrs->sort();
+ attrs.alloc("system").mkString(settings.thisSystem.get());
auto vRes = evalState->allocValue();
- evalState->callFunction(*bundler.toValue(*evalState).first, *arg, *vRes, noPos);
+ evalState->callFunction(
+ *bundler.toValue(*evalState).first,
+ evalState->allocValue()->mkAttrs(attrs),
+ *vRes, noPos);
if (!evalState->isDerivation(*vRes))
throw Error("the bundler '%s' does not produce a derivation", bundler.what());