From 4bd687e3e677c3c89603d8738a94c74c51d4f9ba Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 3 May 2024 10:34:56 -0400 Subject: [PATCH] Update to Nix 2.22 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nix': 'github:NixOS/nix/60824fa97c588a0faf68ea61260a47e388b0a4e5' (2024-04-11) → 'github:NixOS/nix/1c8150ac312b5f9ba1b3f6768ff43b09867e5883' (2024-04-23) • Added input 'nix/flake-parts': 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d' (2024-04-01) • Added input 'nix/flake-parts/nixpkgs-lib': follows 'nix/nixpkgs' • Added input 'nix/pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/40e6053ecb65fcbf12863338a6dcefb3f55f1bf8' (2024-04-12) • Added input 'nix/pre-commit-hooks/flake-compat': follows 'nix' • Added input 'nix/pre-commit-hooks/flake-utils': 'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02) • Added input 'nix/pre-commit-hooks/gitignore': follows 'nix' • Added input 'nix/pre-commit-hooks/nixpkgs': follows 'nix/nixpkgs' • Added input 'nix/pre-commit-hooks/nixpkgs-stable': follows 'nix/nixpkgs' --- flake.lock | 80 ++++++++++++++++++++++++-- flake.nix | 2 +- src/hydra-eval-jobs/hydra-eval-jobs.cc | 18 +++--- 3 files changed, 85 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 966431f9..e828aa7b 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,42 @@ "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": { "flake": false, "locked": { @@ -35,23 +71,25 @@ "nix": { "inputs": { "flake-compat": "flake-compat", + "flake-parts": "flake-parts", "libgit2": "libgit2", "nixpkgs": [ "nixpkgs" ], - "nixpkgs-regression": "nixpkgs-regression" + "nixpkgs-regression": "nixpkgs-regression", + "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1712849398, - "narHash": "sha256-10z/SoidVl9/lh56cMLj7ntJZHtVrumFvmn1YEqXmaM=", + "lastModified": 1713874370, + "narHash": "sha256-gW1mO/CvsQQ5gvgiwzxsGhPFI/tx30NING+qgF5Do0s=", "owner": "NixOS", "repo": "nix", - "rev": "60824fa97c588a0faf68ea61260a47e388b0a4e5", + "rev": "1c8150ac312b5f9ba1b3f6768ff43b09867e5883", "type": "github" }, "original": { "owner": "NixOS", - "ref": "2.21-maintenance", + "ref": "2.22-maintenance", "repo": "nix", "type": "github" } @@ -88,6 +126,38 @@ "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": { "inputs": { "nix": "nix", diff --git a/flake.nix b/flake.nix index c6646200..82824733 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "A Nix-based continuous build system"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11-small"; - inputs.nix.url = "github:NixOS/nix/2.21-maintenance"; + inputs.nix.url = "github:NixOS/nix/2.22-maintenance"; inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, nixpkgs, nix }: diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index d5619719..5adea42b 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -102,8 +102,8 @@ static std::string queryMetaStrings(EvalState & state, PackageInfo & drv, const for (unsigned int n = 0; n < v.listSize(); ++n) rec(*v.listElems()[n]); else if (v.type() == nAttrs) { - auto a = v.attrs->find(state.symbols.create(subAttribute)); - if (a != v.attrs->end()) + auto a = v.attrs()->find(state.symbols.create(subAttribute)); + if (a != v.attrs()->end()) 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); - auto vOutputs = vFlake->attrs->get(state.symbols.create("outputs"))->value; + auto vOutputs = vFlake->attrs()->get(state.symbols.create("outputs"))->value; state.forceValue(*vOutputs, noPos); - auto aHydraJobs = vOutputs->attrs->get(state.symbols.create("hydraJobs")); + auto aHydraJobs = vOutputs->attrs()->get(state.symbols.create("hydraJobs")); if (!aHydraJobs) - aHydraJobs = vOutputs->attrs->get(state.symbols.create("checks")); + aHydraJobs = vOutputs->attrs()->get(state.symbols.create("checks")); if (!aHydraJobs) 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); /* 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")) { - auto a = v->attrs->get(state.symbols.create("constituents")); + auto a = v->attrs()->get(state.symbols.create("constituents")); if (!a) state.error("derivation must have a ‘constituents’ attribute").debugThrow(); @@ -260,7 +260,7 @@ static void worker( else if (v->type() == nAttrs) { auto attrs = nlohmann::json::array(); 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]); if (name.find(' ') != std::string::npos) { printError("skipping job with illegal name '%s'", name); @@ -368,7 +368,7 @@ int main(int argc, char * * argv) ]() { try { - EvalState state(myArgs.searchPath, openStore()); + EvalState state(myArgs.lookupPath, openStore()); Bindings & autoArgs = *myArgs.getAutoArgs(state); worker(state, autoArgs, *to, *from); } catch (Error & e) {