parent
ce225615c3
commit
1b05792988
|
@ -468,10 +468,12 @@ static void prim_callNonFlake(EvalState & state, const Pos & pos, Value * * args
|
||||||
void callFlake(EvalState & state,
|
void callFlake(EvalState & state,
|
||||||
const Flake & flake,
|
const Flake & flake,
|
||||||
const FlakeInputs & inputs,
|
const FlakeInputs & inputs,
|
||||||
Value & v)
|
Value & vRes)
|
||||||
{
|
{
|
||||||
// Construct the resulting attrset '{description, outputs,
|
// Construct the resulting attrset '{outputs, ...}'. This attrset
|
||||||
// ...}'. This attrset is passed lazily as an argument to 'outputs'.
|
// is passed lazily as an argument to the 'outputs' function.
|
||||||
|
|
||||||
|
auto & v = *state.allocValue();
|
||||||
|
|
||||||
state.mkAttrs(v,
|
state.mkAttrs(v,
|
||||||
inputs.flakeInputs.size() +
|
inputs.flakeInputs.size() +
|
||||||
|
@ -513,6 +515,14 @@ void callFlake(EvalState & state,
|
||||||
v.attrs->push_back(Attr(state.symbols.create("self"), &v));
|
v.attrs->push_back(Attr(state.symbols.create("self"), &v));
|
||||||
|
|
||||||
v.attrs->sort();
|
v.attrs->sort();
|
||||||
|
|
||||||
|
/* For convenience, put the outputs directly in the result, so you
|
||||||
|
can refer to an output of an input as 'inputs.foo.bar' rather
|
||||||
|
than 'inputs.foo.outputs.bar'. */
|
||||||
|
auto v2 = *state.allocValue();
|
||||||
|
state.eval(state.parseExprFromString("res: res.outputs // res", "/"), v2);
|
||||||
|
|
||||||
|
state.callFunction(v2, v, vRes, noPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void callFlake(EvalState & state,
|
void callFlake(EvalState & state,
|
||||||
|
|
|
@ -55,7 +55,7 @@ cat > $flake2Dir/flake.nix <<EOF
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
|
||||||
outputs = inputs: rec {
|
outputs = inputs: rec {
|
||||||
packages.bar = inputs.flake1.outputs.packages.foo;
|
packages.bar = inputs.flake1.packages.foo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -74,7 +74,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
|
||||||
outputs = inputs: rec {
|
outputs = inputs: rec {
|
||||||
packages.xyzzy = inputs.flake2.outputs.packages.bar;
|
packages.xyzzy = inputs.flake2.packages.bar;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -176,8 +176,8 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
|
||||||
outputs = inputs: rec {
|
outputs = inputs: rec {
|
||||||
packages.xyzzy = inputs.flake2.outputs.packages.bar;
|
packages.xyzzy = inputs.flake2.packages.bar;
|
||||||
packages.sth = inputs.flake1.outputs.packages.foo;
|
packages.sth = inputs.flake1.packages.foo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -233,8 +233,8 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
|
||||||
outputs = inputs: rec {
|
outputs = inputs: rec {
|
||||||
packages.xyzzy = inputs.flake2.outputs.packages.bar;
|
packages.xyzzy = inputs.flake2.packages.bar;
|
||||||
packages.sth = inputs.flake1.outputs.packages.foo;
|
packages.sth = inputs.flake1.packages.foo;
|
||||||
packages.fnord =
|
packages.fnord =
|
||||||
with import ./config.nix;
|
with import ./config.nix;
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
|
|
Loading…
Reference in a new issue