-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Source path error improvements #12915
base: master
Are you sure you want to change the base?
Conversation
Cool. Could you write a changelog message for this? This is a major UX improvement. |
ffd65d7
to
8513598
Compare
// Backward compatibility hack: throw an exception if access | ||
// to this path is not allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a hack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah where is FilteringSourceAccessor
even being used anymore? I only see it used with GitExportIgnoreSourceAccessor
// Backward compatibility hack: throw an exception if access | ||
// to this path is not allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a hack?
@@ -91,7 +92,9 @@ static StorePath copyInputToStore( | |||
{ | |||
auto storePath = fetchToStore(*state.store, accessor, FetchMode::Copy, input.getName()); | |||
|
|||
state.allowPath(storePath); | |||
state.allowPath(storePath); // FIXME: should just whitelist the entire virtual store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bug:
state.allowPath(storePath); // FIXME: should just whitelist the entire virtual store | |
state.allowPath(storePath); // TODO: we could simply whitelist the entire virtual store, because all of that is created by the evaluator and its allowed external sources |
This could use some clarification so that others can follow.
What you're suggesting as the next step is to provide lazy copying. I hope I'm not adding to the confusion. |
I suggest we do this in conjunction with #12531 |
I changed #12531 as discussed in the meeting, and then rebased this on top in https://github.com/Ericson2314/nix/tree/source-path-errors |
This makes paths in error messages behave similar to lazy-trees, e.g. instead of store paths like error: attribute 'foobar' missing at /nix/store/ddzfiipzqlrh3gnprmqbadnsnrxsmc9i-source/machine/configuration.nix:209:7: 208| 209| pkgs.foobar | ^ 210| ]; you now get error: attribute 'foobar' missing at /home/eelco/Misc/eelco-configurations/machine/configuration.nix:209:7: 208| 209| pkgs.foobar | ^ 210| ]; In fact, we don't even need to copy the inputs to the store at all, so this gets us very close to lazy trees. We just need to know the store path so that requires hashing the entire input, which isn't lazy. But the next step will be to use a virtual store path that gets rewritten to the actual store path only when needed.
8513598
to
addec3c
Compare
Motivation
Based on #12532 but heavily modified.
We now "mount" the source accessors of flake inputs on top of /nix/store (i.e. the MountedSourceAccessor named storeFS). This allows error messages similar to the lazy-trees branch, i.e. referring to the original source trees (like a Git repo) instead of the store path to which the input was copied.
For example, instead of
you now get
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.