Merge branch 'nix-2.22' into nix-next

This commit is contained in:
John Ericson 2024-05-03 10:49:28 -04:00
commit 410077a26e
2 changed files with 83 additions and 13 deletions

78
flake.lock generated
View File

@ -16,6 +16,42 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"libgit2": { "libgit2": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -35,18 +71,20 @@
"nix": { "nix": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"libgit2": "libgit2", "libgit2": "libgit2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-regression": "nixpkgs-regression" "nixpkgs-regression": "nixpkgs-regression",
"pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1712957033, "lastModified": 1714701944,
"narHash": "sha256-/P298re0Qga0eJV3Q3BppvYbVEN0CKXMnxMQX192hcE=", "narHash": "sha256-trTxWfGElp0rkjquqG5I5RYVoxo8foCflxJFUtHwnOQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nix", "repo": "nix",
"rev": "aa438b8fbaebbbdb922655127053c4e8ea3e55bb", "rev": "00ca2b05b8fbbef09be5d1e4820857605d4c31b6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -87,6 +125,38 @@
"type": "github" "type": "github"
} }
}, },
"pre-commit-hooks": {
"inputs": {
"flake-compat": [
"nix"
],
"flake-utils": "flake-utils",
"gitignore": [
"nix"
],
"nixpkgs": [
"nix",
"nixpkgs"
],
"nixpkgs-stable": [
"nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712897695,
"narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"nix": "nix", "nix": "nix",

View File

@ -102,8 +102,8 @@ static std::string queryMetaStrings(EvalState & state, PackageInfo & drv, const
for (unsigned int n = 0; n < v.listSize(); ++n) for (unsigned int n = 0; n < v.listSize(); ++n)
rec(*v.listElems()[n]); rec(*v.listElems()[n]);
else if (v.type() == nAttrs) { else if (v.type() == nAttrs) {
auto a = v.attrs->find(state.symbols.create(subAttribute)); auto a = v.attrs()->find(state.symbols.create(subAttribute));
if (a != v.attrs->end()) if (a != v.attrs()->end())
res.push_back(std::string(state.forceString(*a->value, a->pos, "while evaluating meta attributes"))); res.push_back(std::string(state.forceString(*a->value, a->pos, "while evaluating meta attributes")));
} }
}; };
@ -138,12 +138,12 @@ static void worker(
callFlake(state, lockedFlake, *vFlake); callFlake(state, lockedFlake, *vFlake);
auto vOutputs = vFlake->attrs->get(state.symbols.create("outputs"))->value; auto vOutputs = vFlake->attrs()->get(state.symbols.create("outputs"))->value;
state.forceValue(*vOutputs, noPos); state.forceValue(*vOutputs, noPos);
auto aHydraJobs = vOutputs->attrs->get(state.symbols.create("hydraJobs")); auto aHydraJobs = vOutputs->attrs()->get(state.symbols.create("hydraJobs"));
if (!aHydraJobs) if (!aHydraJobs)
aHydraJobs = vOutputs->attrs->get(state.symbols.create("checks")); aHydraJobs = vOutputs->attrs()->get(state.symbols.create("checks"));
if (!aHydraJobs) if (!aHydraJobs)
throw Error("flake '%s' does not provide any Hydra jobs or checks", flakeRef); throw Error("flake '%s' does not provide any Hydra jobs or checks", flakeRef);
@ -204,9 +204,9 @@ static void worker(
job["isChannel"] = drv->queryMetaBool("isHydraChannel", false); job["isChannel"] = drv->queryMetaBool("isHydraChannel", false);
/* If this is an aggregate, then get its constituents. */ /* If this is an aggregate, then get its constituents. */
auto a = v->attrs->get(state.symbols.create("_hydraAggregate")); auto a = v->attrs()->get(state.symbols.create("_hydraAggregate"));
if (a && state.forceBool(*a->value, a->pos, "while evaluating the `_hydraAggregate` attribute")) { if (a && state.forceBool(*a->value, a->pos, "while evaluating the `_hydraAggregate` attribute")) {
auto a = v->attrs->get(state.symbols.create("constituents")); auto a = v->attrs()->get(state.symbols.create("constituents"));
if (!a) if (!a)
state.error<EvalError>("derivation must have a constituents attribute").debugThrow(); state.error<EvalError>("derivation must have a constituents attribute").debugThrow();
@ -260,7 +260,7 @@ static void worker(
else if (v->type() == nAttrs) { else if (v->type() == nAttrs) {
auto attrs = nlohmann::json::array(); auto attrs = nlohmann::json::array();
StringSet ss; StringSet ss;
for (auto & i : v->attrs->lexicographicOrder(state.symbols)) { for (auto & i : v->attrs()->lexicographicOrder(state.symbols)) {
std::string name(state.symbols[i->name]); std::string name(state.symbols[i->name]);
if (name.find(' ') != std::string::npos) { if (name.find(' ') != std::string::npos) {
printError("skipping job with illegal name '%s'", name); printError("skipping job with illegal name '%s'", name);
@ -368,7 +368,7 @@ int main(int argc, char * * argv)
]() ]()
{ {
try { try {
EvalState state(myArgs.searchPath, openStore()); EvalState state(myArgs.lookupPath, openStore());
Bindings & autoArgs = *myArgs.getAutoArgs(state); Bindings & autoArgs = *myArgs.getAutoArgs(state);
worker(state, autoArgs, *to, *from); worker(state, autoArgs, *to, *from);
} catch (Error & e) { } catch (Error & e) {