forked from lix-project/nix-eval-jobs
Select flake output by the flake fragment
This commit is contained in:
parent
434376f8e1
commit
0648bc0cb8
|
@ -112,7 +112,7 @@ static void worker(
|
||||||
if (myArgs.flake) {
|
if (myArgs.flake) {
|
||||||
using namespace flake;
|
using namespace flake;
|
||||||
|
|
||||||
auto flakeRef = parseFlakeRef(myArgs.releaseExpr, absPath("."));
|
auto [flakeRef, fragment] = parseFlakeRefWithFragment(myArgs.releaseExpr, absPath("."));
|
||||||
|
|
||||||
auto vFlake = state.allocValue();
|
auto vFlake = state.allocValue();
|
||||||
|
|
||||||
|
@ -127,14 +127,15 @@ static void worker(
|
||||||
|
|
||||||
auto vOutputs = vFlake->attrs->get(state.symbols.create("outputs"))->value;
|
auto vOutputs = vFlake->attrs->get(state.symbols.create("outputs"))->value;
|
||||||
state.forceValue(*vOutputs);
|
state.forceValue(*vOutputs);
|
||||||
|
vTop = *vOutputs;
|
||||||
|
|
||||||
auto aHydraJobs = vOutputs->attrs->get(state.symbols.create("hydraJobs"));
|
if (fragment.length() > 0) {
|
||||||
if (!aHydraJobs)
|
Bindings & bindings(*state.allocBindings(0));
|
||||||
aHydraJobs = vOutputs->attrs->get(state.symbols.create("checks"));
|
auto [nTop, pos] = findAlongAttrPath(state, fragment, bindings, vTop);
|
||||||
if (!aHydraJobs)
|
if (!nTop)
|
||||||
throw Error("flake '%s' does not provide any Hydra jobs or checks", flakeRef);
|
throw Error("error: attribute '%s' missing", nTop);
|
||||||
|
vTop = *nTop;
|
||||||
vTop = *aHydraJobs->value;
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
state.evalFile(lookupFileArg(state, myArgs.releaseExpr), vTop);
|
state.evalFile(lookupFileArg(state, myArgs.releaseExpr), vTop);
|
||||||
|
|
|
@ -36,7 +36,7 @@ def common_test(extra_args: List[str]) -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_flake() -> None:
|
def test_flake() -> None:
|
||||||
common_test(["--flake", ".#"])
|
common_test(["--flake", ".#hydraJobs"])
|
||||||
|
|
||||||
|
|
||||||
def test_expression() -> None:
|
def test_expression() -> None:
|
||||||
|
|
Loading…
Reference in a new issue