|
38 | 38 | # 2. Write the $out/nix-support/propagated-native-build-inputs file |
39 | 39 | # |
40 | 40 | # Step 2 is critical: writeShellApplication uses writeTextFile internally, |
41 | | -# which does NOT run stdenv.mkDerivation's fixupPhase. That fixupPhase is |
42 | | -# what normally materializes the propagatedNativeBuildInputs derivation |
| 41 | +# which sets `buildCommand` in the derivation. When buildCommand is set, |
| 42 | +# stdenv's genericBuild skips the entire phase system — installPhase, |
| 43 | +# postInstall, fixupPhase — none of them run. The fixupPhase is what |
| 44 | +# normally materializes the propagatedNativeBuildInputs derivation |
43 | 45 | # attribute into the $out/nix-support/propagated-native-build-inputs file |
44 | 46 | # that setup.sh's findInputs reads at runtime. Without the file on disk, |
45 | 47 | # setting the attribute alone has no effect — setup.sh never sees it. |
46 | 48 | # |
| 49 | +# We therefore append the file creation directly to buildCommand, since |
| 50 | +# that is the only code path the builder actually executes. |
| 51 | +# |
47 | 52 | # With the file in place, when stdenv's setup.sh processes the wrapper |
48 | 53 | # from buildInputs or nativeBuildInputs, it: |
49 | 54 | # |
|
86 | 91 | propagatedNativeBuildInputs = |
87 | 92 | (old.propagatedNativeBuildInputs or []) ++ allPropagated; |
88 | 93 |
|
89 | | - # writeShellApplication (via writeTextFile) does NOT run stdenv's |
90 | | - # fixupPhase, so the propagatedNativeBuildInputs attribute is never |
91 | | - # materialized into the nix-support/ file that setup.sh reads. |
92 | | - # We create it explicitly in postInstall. |
93 | | - postInstall = (old.postInstall or "") + '' |
| 94 | + # writeTextFile uses `buildCommand` which bypasses stdenv's entire |
| 95 | + # phase system — neither postInstall nor fixupPhase ever runs. |
| 96 | + # We must append our file creation directly to buildCommand. |
| 97 | + buildCommand = (old.buildCommand or "") + '' |
94 | 98 | mkdir -p $out/nix-support |
95 | 99 | echo "${propagatedPathsStr}" > $out/nix-support/propagated-native-build-inputs |
96 | 100 | ''; |
|
0 commit comments