Add --cold flag to estimate a from-scratch build (ignore local cache) #1

Open
opened 2026-07-07 20:12:41 +03:00 by oleks · 0 comments
Owner

Problem

When the target is already fully built/cached, nix build --dry-run reports 0 to-build, so to_build_set() returns an empty set and the CLI prints "Nothing to build — the whole closure substitutes from cache." There is no way to ask the more common sizing question: "how long would this take to build from scratch?"

Observed on emmett: .#nixosConfigurations.emmett.config.system.build.toplevel on x86 (fully built locally) gives 0 to-build, even though the real closure is 18,727 derivations.

Fix

The escape hatch already exists in the code: build_dag() treats to_build=None as "use the whole closure" (cold-cache over-estimate). Nothing triggers it from the CLI.

  • Add --cold (alias --full) to cli.py that forces to_build=None, bypassing to_build_set().
  • Report line should distinguish "cold estimate (whole closure)" from the cache-aware default so the output isn't mistaken for a warm-cache run.

Small, self-contained. Directly fixes the "nothing to build" dead-end seen in the emmett trial.

## Problem When the target is already fully built/cached, `nix build --dry-run` reports 0 to-build, so `to_build_set()` returns an empty set and the CLI prints *"Nothing to build — the whole closure substitutes from cache."* There is no way to ask the more common sizing question: **"how long would this take to build from scratch?"** Observed on emmett: `.#nixosConfigurations.emmett.config.system.build.toplevel` on x86 (fully built locally) gives 0 to-build, even though the real closure is 18,727 derivations. ## Fix The escape hatch already exists in the code: `build_dag()` treats `to_build=None` as "use the whole closure" (cold-cache over-estimate). Nothing triggers it from the CLI. - Add `--cold` (alias `--full`) to `cli.py` that forces `to_build=None`, bypassing `to_build_set()`. - Report line should distinguish "cold estimate (whole closure)" from the cache-aware default so the output isn't mistaken for a warm-cache run. Small, self-contained. Directly fixes the "nothing to build" dead-end seen in the emmett trial.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/nix-estimator#1