ci/eval: fix local full eval#442035
Conversation
|
I have never had good experiences with Is the thing we want just stringification? |
No, the thing we want is to register a dependency on an existing nix/store path that is passed as an argument. |
Yes, that would probably happen when trying to instantiate (?) that thing, I guess. It's just a dummy derivation that this function creates, not a "real" one. |
In this case we only use the "derivation" to get its outPath, so it should be fine that it's a fake derivation. Although this makes me wonder (again) if we should explicitly use the stringified derivation (i.e. the in-store path) rather than a real/fake derivation attrset? It feels like we're relying on the assumption that we'll only use the stringified derivation later in the expression. So making that explicit early on feels like a good move. |
|
I have a note on my notepad to remove import-from-derivation in this code. Is this at all related? |
|
I don't think we have IFD there anywhere. |
Details |
|
I did try this command on a different branch, but got the same error that we're trying to fix here: But it will be there with or without But indeed, with this PR*, it does make a difference - because I don't think we can change that, ever? Edit: |
|
Let's put it this way: We could pretend to not do IFD in the CI case, because we serialize the steps there anyway (not much difference to what happens in the IFD case, actually, because we have multiple eval / build steps alternating, too). But it's hard, without rewriting the diff + compare parts to not rely on nix code, to avoid IFD for the local evaluation. I don't think it's worthy or relevant goal either. IFD is perfectly fine here. |
Ah, yes, absolutely true. My wonder was if the use of IFD made the directories here more likely to encounter strange not-found errors. No evidence for it. |
philiptaron
left a comment
There was a problem hiding this comment.
I tested it out locally and this does indeed work.
The change to use `builtins.storePath` was good - for when the store path *is* already part of the nix store. In all my tests so far, that was already the case, because I was iterating on the solution and the Eval results stayed the same. But when this is run on a entirely new commit, these the values for `afterDir` and `combinedDir` are *not* in the store, yet. As part of running `eval.full` on a new commit they will be created. `eval.full` is linked up, so that the values passed around there will actually be derivations, which might not be realized, yet. Checking whether the input is a path or not fixes this for both cases.
5dc6dde to
b9d4098
Compare
| }: | ||
| let | ||
| combined = builtins.storePath combinedDir; | ||
| # Usually we expect a derivation, but when evaluating in multiple separate steps, we pass |
There was a problem hiding this comment.
If what @philiptaron is saying about toDerivation being unreliable when you try and use its result as an actual derivation is accurate, then my preference shifts back to something like:
| # Usually we expect a derivation, but when evaluating in multiple separate steps, we pass | |
| combined = "${if lib.isDerivation combinedDir then combinedDir else lib.toDerivation combinedDir}"; |
Or
| # Usually we expect a derivation, but when evaluating in multiple separate steps, we pass | |
| combined = if lib.isDerivation combinedDir then "${combinedDir}" else builtins.storePath combinedDir; |
As these are explicit about returning a store path rather than a maybe-real/maybe-fake derivation-attrset.
I'm open to counter arguments or a demonstration that toDerivation doesn't cause the issues Philip alludes to, though.
(Edit: my comment ended up on the wrong line, so my suggestions are messed up)
There was a problem hiding this comment.
I'm having a hard time to come up with a case where the fake derivation would be a problem. Would we need to.. somehow expose this derivation and then try to do something with nix-env on it or so? Like explicitly querying its drvPath?
This seems so unlikely to me that I wouldn't bother the complication.
There was a problem hiding this comment.
To see the "it's not a real derivation" error message, do this in the repl (nix repl -f. in the nixpkgs root):
:b lib.toDerivation "${./default.nix}"
There was a problem hiding this comment.
Yeah - to hit that, these fake derivations would need to be somehow exposed as attributes. I don't know how to get to them, though.
My experiene so far was the opposite: The IFD parts worked even before I made the switch to |
MattSturgeon
left a comment
There was a problem hiding this comment.
LGTM, other than my nitpick that we could bikeshed all day 🫣
|
Successfully created backport PR for |
The change to use
builtins.storePathwas good - for when the store path is already part of the nix store. In all my tests so far, that was already the case, because I was iterating on the solution and the Eval results stayed the same.But when this is run on a entirely new commit, these the values for
afterDirandcombinedDirare not in the store, yet. As part of runningeval.fullon a new commit they will be created.eval.fullis linked up, so that the values passed around there will actually be derivations, which might not be realized, yet.Checking whether the input is a path or not fixes this for both cases.
Follow up to #441746, again.
Things done
Add a 👍 reaction to pull requests you find important.