Skip to content

⚡ Optimize unstable nixpkgs instantiation#14

Merged
whitestrake merged 2 commits intomasterfrom
perf/optimize-nixpkgs-instantiation-7694995513334571880
Feb 5, 2026
Merged

⚡ Optimize unstable nixpkgs instantiation#14
whitestrake merged 2 commits intomasterfrom
perf/optimize-nixpkgs-instantiation-7694995513334571880

Conversation

@whitestrake
Copy link
Copy Markdown
Owner

💡 What:

  • Hoisted the instantiation of nixpkgs-unstable out of common/all-systems.nix (which runs for every host) into flake.nix (which runs once per system architecture).
  • Passed the instantiated unstable package set to modules via specialArgs.
  • Updated common/all-systems.nix to use the injected unstable argument in the overlay.

🎯 Why:

  • Previously, nixpkgs-unstable was imported and instantiated separately for every single host configuration. This is inefficient as it forces the evaluation of the entire unstable package set multiple times (once for each host of the same architecture).
  • By instantiating it once in flake.nix and sharing it, we reduce redundant evaluation work.

📊 Measured Improvement:

  • Benchmark: time nix eval .#checks.x86_64-linux --apply 'x: map (n: x.${n}.drvPath) (builtins.attrNames x)'
  • Baseline: ~1m11s (user time ~1m16s)
  • Optimized: ~1m2s - 1m13s (user time ~1m3s - 1m15s)
  • The benchmark results on the available environment were mixed/inconclusive regarding raw time, likely due to other bottlenecks or caching, but the change is structurally strictly more efficient and prevents O(N) instantiation of the unstable package set.

PR created automatically by Jules for task 7694995513334571880 started by @whitestrake

Move the instantiation of `nixpkgs-unstable` from the per-host module
to `flake.nix` to avoid repeated evaluation for every host.Pass the instantiated package set via `specialArgs` to the modules.

Co-authored-by: whitestrake <9500326+whitestrake@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@whitestrake whitestrake merged commit a34d668 into master Feb 5, 2026
32 checks passed
@whitestrake whitestrake deleted the perf/optimize-nixpkgs-instantiation-7694995513334571880 branch February 5, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant