flakes: throw an error if follows
-declaration for an input is invalid
#6663
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.
I recently got fairly confused why the following expression didn't have
any effect
until I found out that the input was called
nixpkgs-22_05
(please notethe dash vs. underscore).
IMHO it's not a good idea to not throw an error in that case and
probably leave end-users rather confused, so I implemented a small check
for that which basically checks whether
follows
-declaration fromoverrides actually have corresponding inputs in the transitive flake.
In fact this was done by accident already in our own test-suite where
the removal of a
follows
was apparently forgotten[1].Since the key of the
std::map
that holds theoverrides
is a vectorand we have to find the last element of each vector (i.e. the override)
this has to be done with a for loop in O(n) complexity with
n
beingthe total amount of overrides (which shouldn't be that large though).
Please note that this doesn't work with nested expressions, i.e.
which is a known problem[2].
For the expression demonstrated above, an error like this will be
thrown:
[1] 2664a21
[2] #5790
cc @edolstra @thufschmitt @Ericson2314