diff --git a/file-cache.hh b/file-cache.hh index a7f1916..505822c 100644 --- a/file-cache.hh +++ b/file-cache.hh @@ -59,7 +59,7 @@ public: state->db.exec(cacheSchema); if (sqlite3_busy_timeout(state->db, 60 * 60 * 1000) != SQLITE_OK) - throwSQLiteError(state->db, "setting timeout"); + SQLiteError::throw_(state->db, "setting timeout"); state->queryPath.create(state->db, "select id from StorePaths where path = ?"); diff --git a/flake.nix b/flake.nix index 475afaf..785407e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,13 @@ { description = "Script for generating Nixpkgs/NixOS channels"; - inputs.nixpkgs.url = "nixpkgs/nixos-20.03"; + inputs.nixpkgs.follows = "nix/nixpkgs"; outputs = { self, nixpkgs, nix }: { - overlay = final: prev: { + overlays.default = final: prev: { nixos-channel-native-programs = with final; stdenv.mkDerivation { name = "nixos-channel-native-programs"; @@ -75,7 +75,7 @@ defaultPackage.x86_64-linux = (import nixpkgs { system = "x86_64-linux"; - overlays = [ nix.overlay self.overlay ]; + overlays = [ nix.overlays.default self.overlays.default ]; }).nixos-channel-scripts; }; diff --git a/generate-programs-index.cc b/generate-programs-index.cc index 6206c72..80da6ee 100644 --- a/generate-programs-index.cc +++ b/generate-programs-index.cc @@ -91,15 +91,10 @@ void mainWrapped(int argc, char * * argv) DrvInfos packages; for (auto system : std::set{"x86_64-linux", "aarch64-linux"}) { - auto args = state.allocBindings(2); - Value * vConfig = state.allocValue(); - state.mkAttrs(*vConfig, 0); - args->push_back(Attr(state.symbols.create("config"), vConfig)); - Value * vSystem = state.allocValue(); - mkString(*vSystem, system); - args->push_back(Attr(state.symbols.create("system"), vSystem)); - args->sort(); - getDerivations(state, vRoot, "", *args, packages, true); + auto args = state.buildBindings(2); + args.alloc(state.symbols.create("config")).mkAttrs(&state.emptyBindings); + args.alloc(state.symbols.create("system")).mkString(system); + getDerivations(state, vRoot, "", *args.finish(), packages, true); } /* For each store path, figure out the package with the shortest @@ -110,15 +105,15 @@ void mainWrapped(int argc, char * * argv) try { auto outputs = package.queryOutputs(true); - for (auto & output : outputs) { - auto storePath = binaryCache->parseStorePath(output.second); - if (!allowedPathsClosure.count(storePath)) continue; - auto i = packagesByPath.find(storePath); + for (auto & [_, storePath] : outputs) { + if (!storePath) continue; + if (!allowedPathsClosure.count(*storePath)) continue; + auto i = packagesByPath.find(*storePath); if (i != packagesByPath.end() && (i->second->attrPath.size() < package.attrPath.size() || (i->second->attrPath.size() == package.attrPath.size() && i->second->attrPath < package.attrPath))) continue; - packagesByPath.emplace(std::move(storePath), &package); + packagesByPath.emplace(std::move(*storePath), &package); } } catch (AssertionError & e) { } catch (Error & e) {