Test nested sandboxing, and make nicer error #8696
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
We were bedeviled by sandboxing issues when working on the layered store. The problem ended up being that when we have nested nix builds, and the inner store is inside the build dir (e.g. store is
/build/nix-test/$name/store
, build dir is/build
) bind mounts clobber each other and store paths cannot be found.After thoroughly cleaning up
local-derivation-goal.cc
, we might be able to make that work. But that is a lot of work. For now, we just fail earlier with a proper error message.Finally, test this: nested sandboxing without the problematic store dir should work, and with should fail with the expected error message.
Context
Came from work on NixOS/rfcs#152, but not actually part of that feature, good to merge either way.
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.