1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Merge pull request #10345 from edolstra/fix-chroot-flakes

Fix flake evaluation in chroot stores
This commit is contained in:
Théophane Hufschmitt 2024-04-02 17:49:45 +02:00 committed by GitHub
commit 290be6c906
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 24 deletions

View file

@ -10,6 +10,7 @@
#include "finally.hh"
#include "fetch-settings.hh"
#include "value-to-json.hh"
#include "local-fs-store.hh"
namespace nix {
@ -755,7 +756,17 @@ void callFlake(EvalState & state,
auto lockedNode = node.dynamic_pointer_cast<const LockedNode>();
auto [storePath, subdir] = state.store->toStorePath(sourcePath.path.abs());
// FIXME: This is a hack to support chroot stores. Remove this
// once we can pass a sourcePath rather than a storePath to
// call-flake.nix.
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());
}
auto [storePath, subdir] = state.store->toStorePath(path);
emitTreeAttrs(
state,