Repository navigation
shellgen: replace builtins.fetchClosure with builtins.appendContext for Lix ≥2.95 compat - #2997
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
…or Lix >=2.95 compat Replaces the experimental builtins.fetchClosure in the generated flake.nix with builtins.appendContext, which has existed since Nix 2.0 and requires no experimental feature. This restores compatibility with Lix >= 2.95, which removed builtins.fetchClosure. Changes: - flake.nix.tmpl: use builtins.appendContext with path context instead of builtins.fetchClosure. The trace wrapper is preserved. - flake_plan.go: delete dead fetchClosureExpr and the IsInBinaryCache branch in glibcPatchFlake.addOutput (Patch packages are never in binary cache). - nix/command.go, internal/nix/nix.go (ExperimentalFlags): drop 'fetch-closure' from the experimental-features flag. - internal/nix/install.go: remove the Lix >=2.95 compatibility gate (no longer needed since we no longer use fetchClosure). - nix/nix.go: remove LixVersionWithoutFetchClosure const and SupportsFetchClosure(); keep IsLix() for future diagnostics. - nix/nix_test.go: remove TestInfoSupportsFetchClosure. - flake_input.go, narinfo_cache.go: update stale comments. Fixes jetify-com#2983.
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.
Summary
This PR fixes #2983 by replacing the experimental
builtins.fetchClosurein the generatedflake.nixwithbuiltins.appendContext, restoring compatibility with Lix ≥ 2.95 which removedbuiltins.fetchClosure.builtins.appendContexthas existed since Nix 2.0, requires no experimental feature, and callsstore->ensurePath()during eval — same substitution behavior asfetchClosure. Verified in the issue to work on both Nix 2.30.2 (pure eval, no extra experimental features beyondnix-command flakes) and Lix 2.95.2.Changes
internal/shellgen/tmpl/flake.nix.tmpl: replace thebuiltins.fetchClosureblock withbuiltins.appendContext. Kept thebuiltins.trace "downloading …"wrapper. Updated the HACK comment to explain the appendContext trick.internal/shellgen/flake_plan.go: delete deadfetchClosureExprmethod and theIsInBinaryCachebranch inglibcPatchFlake.addOutput(Patch packages haveIsInBinaryCache == false, so this branch was unreachable; as noted in the issue,patchGlibcalso accessespkg.name/pkg.buildInputswhich would break if it were ever reached).internal/nix/command.goandinternal/nix/nix.go(ExperimentalFlags): dropfetch-closurefrom the experimental-features list — no code path uses it anymore.internal/nix/install.go: remove the Lix ≥ 2.95 compatibility gate added in fix(nix): detect incompatible Lix and print a clear hint (#2946) #2949; it's no longer needed since we no longer callbuiltins.fetchClosure.nix/nix.go: remove theLixVersionWithoutFetchClosureconstant and theSupportsFetchClosure()method. KeptInfo.IsLix()and the Nix version parsing — useful for future diagnostics.nix/nix_test.go: removeTestInfoSupportsFetchClosure.internal/shellgen/flake_input.go,internal/devpkg/narinfo_cache.go: update stale comments referencingfetchClosure.Verification
go build ./...✅go vet ./...✅go test ./nix/... ./internal/shellgen/... ./internal/devpkg/...✅ (theinternal/nixTestConfigIsUserTrustedfailures are pre-existing and caused by no Nix binary on this build machine, unrelated to this change).Note: CI workflow/test Dockerfile changes to drop
fetch-closurefromnix.confare intentionally omitted from this PR because they requireworkflowscope on the token used here. Leaving the feature enabled in nix.conf is harmless — it just enables the experimental feature server-side; Devbox simply stops using it. Maintainers can clean those up in a follow-up.Fixes #2983.