aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:37:05 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:37:05 -0500
commitfa2d1fb36e2ee92622379b9716f5b06e73aae72e (patch)
treecbb971f4301b53b7e16a75bf9cba0048b2594462 /src/nix/flake.cc
parent22fcfdf18af84bbbbc1bd416a9eed37a64e26eb5 (diff)
Pass system to bundler
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 1190d7997..80d8654bc 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -374,8 +374,9 @@ struct CmdFlakeCheck : FlakeCommand
if (v.type != tLambda)
throw Error("bundler must be a function");
if (!v.lambda.fun->formals ||
- v.lambda.fun->formals->argNames.find(state->symbols.create("program")) == v.lambda.fun->formals->argNames.end())
- throw Error("bundler must take formal argument 'program'");
+ v.lambda.fun->formals->argNames.find(state->symbols.create("program")) == v.lambda.fun->formals->argNames.end() ||
+ v.lambda.fun->formals->argNames.find(state->symbols.create("system")) == v.lambda.fun->formals->argNames.end())
+ throw Error("bundler must take formal arguments 'program' and 'system'");
} catch (Error & e) {
e.addTrace(pos, hintfmt("while checking the template '%s'", attrPath));
throw;
@@ -505,21 +506,13 @@ struct CmdFlakeCheck : FlakeCommand
}
else if (name == "defaultBundler")
- for (auto & attr : *vOutput.attrs) {
- checkSystemName(attr.name, *attr.pos);
- checkBundler(fmt("%s.%s", name, attr.name), *attr.value, *attr.pos);
- }
+ checkBundler(name, vOutput, pos);
else if (name == "bundlers") {
state->forceAttrs(vOutput, pos);
- for (auto & attr : *vOutput.attrs) {
- checkSystemName(attr.name, *attr.pos);
- state->forceAttrs(*attr.value, *attr.pos);
- for (auto & attr2 : *attr.value->attrs)
- checkBundler(
- fmt("%s.%s.%s", name, attr.name, attr2.name),
- *attr2.value, *attr2.pos);
- }
+ for (auto & attr : *vOutput.attrs)
+ checkBundler(fmt("%s.%s", name, attr.name),
+ *attr.value, *attr.pos);
}
else