Propagate writeShellApplication runtimeInputs via propagatedNativeBuildInputs#230
Merged
Conversation
…ldInputs The switch from nix-print-dev-env to devShellTools (a354771) broke runtimeInputs visibility in -env container scripts. writeShellApplication embeds runtimeInputs in the wrapper's own PATH, but $stdenv/setup (which the -env scripts source) only walks buildInputs/nativeBuildInputs — not the internal PATH of wrappers within those inputs. The previous fix (76d6b37) added curl explicitly to buildInputs, but this is fragile: any future runtimeInputs change requires a parallel edit in the shell's input lists. Instead, use propagatedNativeBuildInputs on the wrapper derivation. When $stdenv/setup processes wrapped-cabal from nativeBuildInputs, it transitively follows propagatedNativeBuildInputs and adds curl (and cabal-install) to PATH for the whole environment. This is the standard Nix mechanism for transitive dependency propagation. Applies to all four shell definitions: dynamic, static, cross-js, cross-windows. Removes the explicit curl additions from 76d6b37.
Refactor the inline .overrideAttrs pattern (used to propagate writeShellApplication's runtimeInputs via propagatedNativeBuildInputs) into a shared helper function with extensive documentation explaining why this is needed. The core issue: devx generates -env container scripts using devShellTools, which reconstructs the environment via $stdenv/setup's findInputs. findInputs walks propagatedNativeBuildInputs metadata files but does NOT look inside writeShellApplication wrapper scripts. Without propagation, runtimeInputs (e.g. curl for HTTPS hackage transport) are invisible to the container environment. See writers.nix for the full architectural explanation.
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
Use
propagatedNativeBuildInputsonwrapped-cabalso that itsruntimeInputs(curl, cabal-install) are transitively visible to the entire shell environment via$stdenv/setup.Problem
The switch from
nix print-dev-envtodevShellTools(a354771) changed how-envcontainer scripts reconstruct the shell.writeShellApplicationembedsruntimeInputsin the wrapper's own inline PATH, but$stdenv/setuponly walksbuildInputs/nativeBuildInputs— not the internal PATH of wrappers within those inputs.PR #229 fixed this by adding
curlexplicitly tobuildInputs/nativeBuildInputs, but that's fragile: any futureruntimeInputschange requires a parallel edit in the shell's input lists.Fix
Add
.overrideAttrsto eachwrapped-cabalto setpropagatedNativeBuildInputs = cabalRuntimeInputs. When$stdenv/setupprocesseswrapped-cabalfromnativeBuildInputs, it transitively followspropagatedNativeBuildInputsand addscurl(andcabal-install) to PATH for the entire environment. This is the standard Nix mechanism for transitive dependency propagation.The explicit
curladditions from #229 are removed since they now come through propagation.Files changed
dynamic.nix— propagate runtimeInputs, remove explicit curlstatic.nix— propagate runtimeInputs, remove explicit curlcross-js.nix— propagate runtimeInputs, remove explicit curlcross-windows.nix— propagate runtimeInputs (no explicit curl was added here)Test plan
-env-testsmoke tests pass (curl on PATH via propagation)