Implement dynamic dependencies and remove extra inputs hack#38
Merged
Conversation
d6bffa1 to
c682937
Compare
c682937 to
66f4393
Compare
urbas
approved these changes
Sep 6, 2025
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.
Fix #19 🎉
Allows of arbitrarily deep dynamic dependencies, leveraging all the features of dynamic derivations like
dynamicOutputsandnix-computed-outputplaceholders. This lets us remove the "extra-inputs" hack for compiling CppNix where they had bisonparser.ygenerate.ccsource files that also need header dependency discovery.We introduce a "dynamic-task" derivation that detects that when (1) it has "deps = gcc", i.e. it has header dependency discovery, and (2) it has an input that is built rather than opaque, i.e. it is an output from another derivation, then we must have an intermediary derivation that depends on these built inputs and does header discovery and modifies the task derivation to include these discovered inputs.
There's still some work to do, for example we should do discovery in a task per built input rather than together so we can cache discovery more granularly. CppNix has generated inputs that are often shared across build targets, so there is a bit of wasted discovery atm.
With these changes, it makes it possible to build CppNix end to end without any hacks.