Skip to content
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

Fix flake evaluation in chroot stores #10345

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Mar 27, 2024

Motivation

This is a temporary fix until we can pass SourcePaths rather than StorePaths to call-flake.nix.

Fixes #10331, #10267.

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

This is a temporary fix until we can pass `SourcePath`s rather than
`StorePath`s to `call-flake.nix`.

Fixes NixOS#10331.
Copy link
Member

@thufschmitt thufschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the special-casing is needed, but it seems sound.

Can you add a test for it? The chroot stores are quite fragile and under-tested

Comment on lines +762 to +767
auto path = sourcePath.path.abs();
if (auto store = state.store.dynamic_pointer_cast<LocalFSStore>()) {
auto realStoreDir = store->getRealStoreDir();
if (isInDir(path, realStoreDir))
path = store->storeDir + path.substr(realStoreDir.size());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this use store.getFSAccessor->toRealPath()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because this does the opposite (it converts a real path to a store path).

@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Mar 29, 2024
@thufschmitt thufschmitt merged commit 290be6c into NixOS:master Apr 2, 2024
9 checks passed
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-03-27-nix-team-meeting-134/42961/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression with ~/.local/share/nix/root used as a chroot store
3 participants