Description
A fixed-output derivation is nothing but a regular "floating" content-addressing derivation, along with an assertion that the output is in fact a certain content-address.
Other "output checks" can likewise be turned into assertions that the input satisfies the checks.
It would be conceptually cleaner to instead of making these checks part of a derivation (and thus have more knobs on what is a derivation) instead decompose them to special assertion nodes / in the derivation dependency graph --- or equivalently, special quasi derivations.
I had long thought this would be conceptually more elegant, but hadn't yet found a real tangible concrete use-case they would make things better from the user's perspective. But in #11954 I believe I finally found one. The short version of that is that for CA derivations, it is impossible simultaneously satisfy all of these:
- Keep our current notation of unconditional immediate dependencies that always must be downloaded
- Only do derivation substitutions (of placeholders today, or generalized versions of this one might imagine)
- Support allowed/disallowed dependencies of things we might not end up having in our input runtime closure at all
- Don't unnecessarily download stuff we don't actually need at build-time
Assertion quasi-derivations however provide a way out of that:
- Dependencies can still be considered regular and unconditional (we have more types of nodes in our drv graph, but the dependency edge structure of each node is the same for all node types)
- Rewriting nodes is still done exclusively for incoming immediate edges --- no "non-local" rewriting for transitive deps is ever required
- Support arbitrary allowed/disallowed dependencies based on inputs
- Since we can/must special-case these new node types, simply don't download anything at all based on them, we just need the rewrites to end up with the concrete store paths we need to scan for.
This nicely gets us all 4 desiderata, plus the separation of concerns (building vs linting), with minimal extra complexity.
Activity