fix(nix): remove the nix store cache causing rebuild inconsistencies - #1735
Open
Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
Open
fix(nix): remove the nix store cache causing rebuild inconsistencies#1735Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
Conversation
Venkumahanti Subhankar (V-Subhankar-infy)
requested a balanced review from Copilot
September 9, 2026 11:04
Copilot started reviewing on behalf of
Venkumahanti Subhankar (V-Subhankar-infy)
September 9, 2026 11:05
View session
Venkumahanti Subhankar (V-Subhankar-infy)
requested a balanced review from Copilot
September 10, 2026 05:06
Copilot started reviewing on behalf of
Venkumahanti Subhankar (V-Subhankar-infy)
September 10, 2026 05:06
View session
Venkumahanti Subhankar (V-Subhankar-infy)
requested a balanced review from Copilot
September 10, 2026 05:16
Copilot started reviewing on behalf of
Venkumahanti Subhankar (V-Subhankar-infy)
September 10, 2026 05:17
View session
Venkumahanti Subhankar (V-Subhankar-infy)
requested a balanced review from Copilot
September 10, 2026 05:23
Copilot started reviewing on behalf of
Venkumahanti Subhankar (V-Subhankar-infy)
September 10, 2026 05:24
View session
Venkumahanti Subhankar (V-Subhankar-infy)
requested a balanced review from Copilot
September 10, 2026 05:49
Copilot started reviewing on behalf of
Venkumahanti Subhankar (V-Subhankar-infy)
September 10, 2026 05:50
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation and regression coverage are consistent, with CI sequencing on #1736 already documented.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Venkumahanti Subhankar (V-Subhankar-infy)
marked this pull request as ready for review
September 10, 2026 05:53
Venkumahanti Subhankar (V-Subhankar-infy)
requested a review
from a team
as a code owner
September 10, 2026 05:53
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.
Pre-requisite: First merge the removal of debian 11 for the smoke tests to pass , mentioned in the PR #1736
Closes #1727. Closes #1505.
Problem
The Nix Feature caches
/nixin a persistent Docker volume, and that cache makes rebuilds ignore option changes. Nix and anypackagesare installed into the image at build time, then the volume is mounted over them at container start:{ "source": "nix-store-${devcontainerId}", "target": "/nix", "type": "volume" }Docker fills a named volume from the image only while it is empty, once, at first create; after that it hides what the newer image built.
${devcontainerId}comes from the workspace path, not the config, so every rebuild meets the same frozen volume and options such aspackagesstop taking effect. Removing the cache is the fix.Solution and changes
Remove the cache so the image is what runs.
src/nix/devcontainer-feature.json: drop themountsblock, so nothing is layered over/nix; bump1.3.1→1.4.0.src/nix/NOTES.md: tell affected users which versions were brokensrc/nix/README.md: regenerated withdevcontainer features generate-docstest/nix/extra-config-packages.sh: new test asserting/nixis not a mountpoint, so the cache cannot return unnoticed.test/nix/scenarios.json: register that scenario with theextraNixConfigpluspackagescombination from extraNixConfig breaks package installation #1727.Minor, not major: the volume was never documented, and users pin
ghcr.io/devcontainers/features/nix:1, so a2.0.0would not reach anyone affected.Impact
Measured with
nix: {}, each pass from a full prune.Benefits
devcontainer.jsonalone, and a rebuild resets to zero again.upis 26–33s faster: 135–142s against 168s, since Docker no longer copies all of/nixinto a fresh volume./nixis stored once in the image instead of twice.nix-store-*volume is left behind, which matters becausedocker system prune -a --volumes -fdoes not remove it anyway.docker build, and Docker's layer cache still skips the install when options are unchanged.devcontainer.json, making it a deliberate choice rather than a silent default.Losses
Why it went unnoticed
The first run always works; the volume is created there, so image and volume agree. When it breaks, the usual response is a clean rebuild, which drops the volume and hides the cause. CI never sees it either:
devcontainer features testcreates a fresh volume per scenario, so build A → create → build B against one volume is never run.How is the current cache implementation incomplete ?
Six lines of static metadata, no code behind it. Once seeded the cache is one-way:
docker buildhas no volume attached, and cannot have one./nix, so the image's is never elected.Nothing errors: the mount succeeds and puts older data on top, which is why the failure is silent. The only escapes are
docker volume rm, or reinstalling by hand at runtime after every rebuild.Why a complete cache implementation is expensive
Nix is large, so wanting a cache is reasonable; making one correct is not:
version, garbage-collection, failure-policy, testing.The breaking point in past that caused this issue
#1127 one partially wrong assumption done that:
Self-healing fixes absence, not staleness. It only fires when something installs against the volume, at runtime, never during a build. And nothing is missing: the volume holds a complete, self-consistent Nix that is merely older, so there are no holes to detect and nothing to repair. This was despite the concerns already raised in #284, where both the "reset to zero with a rebuild" invariant and the distinction between cache and runtime directories were stated.