Repository navigation
perf(install): batch nix path-info and prefetch nixpkgs once - #3053
Open
mikeland73 wants to merge 4 commits into
Open
mikeland73 wants to merge 4 commits into
mikeland73 wants to merge 4 commits into
Conversation
Check which packages need installing with one `nix path-info` call per allow_insecure setting instead of one per installable. path-info output can't be mapped back to installables, so a batch is retried one package at a time only if it fails or reports a missing path; that keeps the per-package error messages. Run `nix flake prefetch --json` once and read the store path from its output instead of running prefetch a second time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
[Medium impact] The latest changes appear safe to merge.
|
Split notInStore into helpers to reduce cognitive complexity and use longer variable names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
@greptileai please re-review the latest commits (lint/format fixes since your last review) and approve if there are no issues. Written by Claude on behalf of / prompted by @mikeland73. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Tier 3 item 15 and the
nix flake prefetchbullet of item 17 fromspecs/perf-improvements.md.Batch
nix path-infopackagesToInstallInStoreused to callPackage.GetStorePathsper package, which ran onenix path-infoprocess per installable for every package without store paths in the lockfile (flakes, unresolved packages).New
devpkg.PackagesNotInStore:nix path-info --json --impurefor all remaining installables (one per allow_insecure setting),nix path-info --offlinecall.nix path-infodoesn't say which installable produced which path, so a batch's paths can't be split per package. When every path is in the store (the common, steady-state case) that doesn't matter. When the batch fails or a path is missing, that group is retried one package at a time, sopackageInstallErrorHandlerstill names the failing package and only the right packages get installed. Groups with a single package skip the batch call.The batching logic is generic over the item type and covered by unit tests with a fake nix.
Prefetch nixpkgs once
EnsureNixpkgsPrefetchedrannix flake prefetchto download, then again with--jsonto get the store path. It now runs it once with--json(progress still goes to stderr) and parsesstorePathfrom stdout.Testing
go test ./internal/devpkg ./internal/nix ./internal/devboxDEVBOX_DEBUG=1 devbox installshows a singlepath-infowith both installables followed by one--offlinecheck.nix flake prefetch --jsonoutput shape on nix 2.30.2.🤖 Generated with Claude Code