Update to the latest Nix

This commit is contained in:
Eelco Dolstra 2022-09-08 14:21:15 +02:00
parent 3ed896a90e
commit 6d74f1a131
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 13 additions and 18 deletions

View file

@ -59,7 +59,7 @@ public:
state->db.exec(cacheSchema); state->db.exec(cacheSchema);
if (sqlite3_busy_timeout(state->db, 60 * 60 * 1000) != SQLITE_OK) 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, state->queryPath.create(state->db,
"select id from StorePaths where path = ?"); "select id from StorePaths where path = ?");

View file

@ -1,13 +1,13 @@
{ {
description = "Script for generating Nixpkgs/NixOS channels"; description = "Script for generating Nixpkgs/NixOS channels";
inputs.nixpkgs.url = "nixpkgs/nixos-20.03"; inputs.nixpkgs.follows = "nix/nixpkgs";
outputs = { self, nixpkgs, nix }: outputs = { self, nixpkgs, nix }:
{ {
overlay = final: prev: { overlays.default = final: prev: {
nixos-channel-native-programs = with final; stdenv.mkDerivation { nixos-channel-native-programs = with final; stdenv.mkDerivation {
name = "nixos-channel-native-programs"; name = "nixos-channel-native-programs";
@ -75,7 +75,7 @@
defaultPackage.x86_64-linux = (import nixpkgs { defaultPackage.x86_64-linux = (import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
overlays = [ nix.overlay self.overlay ]; overlays = [ nix.overlays.default self.overlays.default ];
}).nixos-channel-scripts; }).nixos-channel-scripts;
}; };

View file

@ -91,15 +91,10 @@ void mainWrapped(int argc, char * * argv)
DrvInfos packages; DrvInfos packages;
for (auto system : std::set<std::string>{"x86_64-linux", "aarch64-linux"}) { for (auto system : std::set<std::string>{"x86_64-linux", "aarch64-linux"}) {
auto args = state.allocBindings(2); auto args = state.buildBindings(2);
Value * vConfig = state.allocValue(); args.alloc(state.symbols.create("config")).mkAttrs(&state.emptyBindings);
state.mkAttrs(*vConfig, 0); args.alloc(state.symbols.create("system")).mkString(system);
args->push_back(Attr(state.symbols.create("config"), vConfig)); getDerivations(state, vRoot, "", *args.finish(), packages, true);
Value * vSystem = state.allocValue();
mkString(*vSystem, system);
args->push_back(Attr(state.symbols.create("system"), vSystem));
args->sort();
getDerivations(state, vRoot, "", *args, packages, true);
} }
/* For each store path, figure out the package with the shortest /* For each store path, figure out the package with the shortest
@ -110,15 +105,15 @@ void mainWrapped(int argc, char * * argv)
try { try {
auto outputs = package.queryOutputs(true); auto outputs = package.queryOutputs(true);
for (auto & output : outputs) { for (auto & [_, storePath] : outputs) {
auto storePath = binaryCache->parseStorePath(output.second); if (!storePath) continue;
if (!allowedPathsClosure.count(storePath)) continue; if (!allowedPathsClosure.count(*storePath)) continue;
auto i = packagesByPath.find(storePath); auto i = packagesByPath.find(*storePath);
if (i != packagesByPath.end() && if (i != packagesByPath.end() &&
(i->second->attrPath.size() < package.attrPath.size() || (i->second->attrPath.size() < package.attrPath.size() ||
(i->second->attrPath.size() == package.attrPath.size() && i->second->attrPath < package.attrPath))) (i->second->attrPath.size() == package.attrPath.size() && i->second->attrPath < package.attrPath)))
continue; continue;
packagesByPath.emplace(std::move(storePath), &package); packagesByPath.emplace(std::move(*storePath), &package);
} }
} catch (AssertionError & e) { } catch (AssertionError & e) {
} catch (Error & e) { } catch (Error & e) {