allow non-trivial expressions in flakes - #15132
KiaraGrouwstra wants to merge 1 commit into
Conversation
Signed-off-by: cinereal <cinereal@riseup.net>
|
I don't think this is a good idea. It's very predictable that people are going to abuse this in horrible ways, such as doing IFD during the computation of the inputs. So commands like |
|
thanks for the feedback - i'll close then. |
|
@edolstra what we are sure of is that allowing full nix for flakes input would allow for such incorrect behavior But are we sure that the current subset of nix allowed for flakes inputs (basically just static strings) is the only safe option? Would it not be possible to allow for more, safe expressions (still making it a subset of nix instead of full nix) without introducing such risks? |
|
I'm not convinced that Flakes users need to be patronized in this way, or that IFD is particularly problematic here. |
|
#15132 (comment) from @roberth :
This is a strong argument; |
A good question how would stuff like the flake.lock would work in this case if it's unsafe and still will give you IFD? Like it has to import the |
|
Depends, is there a way to ensure that an expression evaluates finally to a static string not requiring IFD? |
|
See #4945 (comment) |
|
Fixes: #5663 |
|
Thinking about this, I think IFD must be considered impure But I think we can make the "prove that a flake input didn't rely on IFD" happen What would it take? |
|
In general, much more than just IFD is unsound. Doing any I/O when initially computing the inputs should probably be considered unsound, in part due to the janky 2-step "refetching" that flakes do for self attrs and the like. That being said, there are currently quite well known workarounds to actually be able to evaluate arbitrary expressions in the inputs, so realistically whatever the intention was it doesn't really work (though that should be considered adversarial expressions and we don't really care about those). A more interesting possibility would be to have the inputs be evaluated in a |
|
That sounds also reasonable At least way better than not allowing any non-trivial input |

lifts flakes' restriction allowing the use of only trivial syntax, which has particularly affected its
inputs.Motivation
inputs, came up as an alternative approach that came up in [RFC 0193] TOML Flakes rfcs#193.inputsyet still allowing to override dependencies using the flakes interfaces (CLI flag--override-input,inputsattribute.follows) as well - sort of as a reverseflake-compat.url = "file:/dev/null";worksContext
inputssection using some function call while simultaneously using tools to write to inputs to update them.)