-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken symlink when trying to create a fixed output derivation using flakes #4859
Comments
A simpler repository reproducing the problem: https://github.com/rgrunbla/hello-broken-flakes
|
I can’t reproduce this (with Nix 2.4pre20210519_af4ff64). In both cases, the |
Here is the config, @regnat : https://0x0.st/-2wf.txt I tried on a single user machine with nix (Nix) 2.4pre20201205_a5d85d0 and it was working well, then I updated to nix (Nix) 2.4pre20210503_6d2553a and it is not working anymore. Is your nix-daemon also at 2.4pre20210519_af4ff64 ? Using your nix version:
|
Ah I managed to reproduce it and found (part) of the issue. The thing that makes these derivations special is that they have a self-reference. (I’m actually quite surprised that this ever worked at all, because references in ca derivations isn’t supposed to be allowed unless the But the thing is that somehow having these references makes Nix hash the output path twice (once modulo-references and once not), causing the “amusingly”, enabling the |
What self-reference are you talking about? Changing |
I mean self-references at the level of store paths (the ones mentioned in https://www.tweag.io/blog/2020-11-18-nix-cas-self-references/ ). They are annoying for content-addressed derivations (FO or not) because they need to point to the the store path under which the result will be stored, but that path is built from the content of the output, including the reference (so you’re kind-of screwed if you try to do things directly that way) |
Right, but what part of this flake introduces a self-reference? Running |
Uh you’re right, I spoke too fast. I still think this is due to the reference. Looks like there’s something weird going on around https://github.com/NixOS/nix/blob/master/src/libstore/store-api.cc#L183-L186 (And interestingly, if you tweak the derivation to use another hash method than |
After a bit more investigation, the discrepancy comes from Line 1257 in 7f31c08
Otoh, the actual output path is computed here and does take into account these references. So the two differ, hence the issue. I’m not sure how we could properly solve this without breaking backwards-compatibility because there’s no way we can know the final output path at evaluation time EDIT: Replaced the links by updated permanent links |
After a second thought, there,s an “obvious” (though not trivial to implement) solution, which is to pre-declare the references for CA derivations. So having an extra argument That way, the eval-time computation of the output path can match the build-time one (and we can fail if the list of declared references doesn’t match the actual one), and everyone’s happy. |
Hello. I'm pretty sure I encountered this bug again, trying to do something totally different than the previous time. Are you working on this, @regnat ? (not pressuring you to do anything, just asking) Thanks, |
Nah sorry, didn’t have time to put more work into this unfortunately |
Hello, using nix (Nix) 2.5pre20211126_55275fc, it seems the steps below are now working. Is the problem being worked-on or is it just some happy coincidence ?
|
Unfortunately, that’s mostly a coincidence, and it still doesn’t really work because although it’s now possible to build a FO derivation with references, it’s not possible to depend on it. For example building |
It works here, it seems:
|
That’s utterly strange… is your daemon also using the same Nix version? |
Sorry for the delay, but yes, the version is the same. |
I marked this as stale due to inactivity. → More info |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
Describe the bug
When trying to build the derivation at https://github.com/sisyphe-re/RIOT with flakes using
nix build
, a broken symlink to the store is created. The derivation is a fixed output derivation.Steps To Reproduce:
Expected behavior
The result should probably not be a broken symlink, and I expect to have access to the output of the fixed output derivation.
nix-env --version
output : nix (Nix) 2.4pre20210503_6d2553aThe text was updated successfully, but these errors were encountered: