Skip to content

Propagate writeShellApplication runtimeInputs via propagatedNativeBuildInputs#230

Merged
angerman merged 2 commits into
mainfrom
fix/propagate-runtimeInputs
Feb 25, 2026
Merged

Propagate writeShellApplication runtimeInputs via propagatedNativeBuildInputs#230
angerman merged 2 commits into
mainfrom
fix/propagate-runtimeInputs

Conversation

@angerman
Copy link
Copy Markdown
Collaborator

Summary

Use propagatedNativeBuildInputs on wrapped-cabal so that its runtimeInputs (curl, cabal-install) are transitively visible to the entire shell environment via $stdenv/setup.

Problem

The switch from nix print-dev-env to devShellTools (a354771) changed how -env container scripts reconstruct the shell. writeShellApplication embeds runtimeInputs in the wrapper's own inline PATH, but $stdenv/setup only walks buildInputs/nativeBuildInputs — not the internal PATH of wrappers within those inputs.

PR #229 fixed this by adding curl explicitly to buildInputs/nativeBuildInputs, but that's fragile: any future runtimeInputs change requires a parallel edit in the shell's input lists.

Fix

Add .overrideAttrs to each wrapped-cabal to set propagatedNativeBuildInputs = cabalRuntimeInputs. When $stdenv/setup processes wrapped-cabal from nativeBuildInputs, it transitively follows propagatedNativeBuildInputs and adds curl (and cabal-install) to PATH for the entire environment. This is the standard Nix mechanism for transitive dependency propagation.

The explicit curl additions from #229 are removed since they now come through propagation.

Files changed

  • dynamic.nix — propagate runtimeInputs, remove explicit curl
  • static.nix — propagate runtimeInputs, remove explicit curl
  • cross-js.nix — propagate runtimeInputs, remove explicit curl
  • cross-windows.nix — propagate runtimeInputs (no explicit curl was added here)

Test plan

…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.
@angerman angerman added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit bae2b4f Feb 25, 2026
884 checks passed
@angerman angerman deleted the fix/propagate-runtimeInputs branch February 25, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant