Repository navigation
Conversation
`nix develop` builds an environment derivation from the user's derivation and removes the output checks, which do not apply to the environment (NixOS#14306). With structured attrs it erases `outputChecks` from the parsed `__json` object. Since 6b92dd2 (NixOS#16374), parsing always keeps the original encoding in `StructuredAttrs::verbatim`, and `unparse` writes that encoding when it is set. So the erase has no effect, and the environment derivation keeps the checks of the original. A check such as `maxSize` then fails the environment build: error: path '/nix/store/…-hello-env' is too large at 112 bytes; limit is 1 bytes Reset `verbatim` after the erase, so that `unparse` encodes the modified object. The existing test did not catch this. It ran `nix develop` inside `[[ -z "$(...)" ]]`, and a failing command prints nothing, which passes. Assign the output first, and add a `maxSize` check that the environment cannot meet. Assisted-by: Claude Code (claude-opus-5-5)
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.
Motivation
nix developandnix print-dev-envkeep theoutputChecksof a structured-attrs derivation in the environment derivation, so a check such asmaxSizefails the environment build:develop.ccerasesoutputChecksfrom the parsed__jsonobject (#14306). Since 6b92dd2 (#16374, "No warn on non-canonical structured attrs"), parsing always keeps the original encoding inStructuredAttrs::verbatim, andunparsewrites that encoding when it is set, so the erase has no effect. No release has 6b92dd2 yet.Implementation
Reset
verbatimafter the erase.The existing test (#14312) did not catch this: it ran
[[ -z "$(nix develop …)" ]], and a failingnix developprints nothing, so the test passed. The test now assigns the output first, and the fixture addsmaxSize = 1, which the environment cannot meet. Without the fix,flakes/developfails with the error above; with it, it passes.Checks, run locally on this change over master 8c8e8b8:
pre-commit,rl-next, the util, store, expr, fetchers and flake unit tests,nix-functional-tests,daemonCompat,hydraJobs.clangTidy,componentTestswith clangStdenv and sanitizers, the Windows cross-build ofnix-util-tests,nix flake show --all-systems, andvmTestsplain and instrumented.hydraJobs.tests.cgroupsfails, as it does on master: since 31cca91, daemon build cgroups are created insidenix-daemon(a separate fix).For reviewing agents
verbatimonly for non-canonical encodings. 6b92dd2 (No warn on non-canonical structured attrs #16374) made it unconditional, which reached every derivation thatnix developreads from the store.develop.cc, not inStructuredAttrs.develop.ccis the only code that mutates a parsedStructuredAttrs(primops.ccbuilds fresh ones withoutverbatim). A setter that clearsverbatimwould be a larger API change for one caller.nix print-dev-env, the env.drvcontains"outputChecks":{"out":{"maxSize":1}}.develop.ccneeds the same reset.outputChecksis the only change it makes tostructuredAttrs; the otherverbatimusers are the parser,operator==andunparse.2.35-maintenance, so no release has the regression.Assisted-by: Claude Code (claude-opus-5-5).Made by Lillecarl and Claude Code together. The commit carries an
Assisted-by:trailer, asCONTRIBUTING.mdrequires.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.