mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
Don't improperly assume path is store path
This commit is contained in:
parent
abea26a968
commit
1c9bec226f
1 changed files with 10 additions and 3 deletions
|
@ -102,10 +102,17 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args
|
||||||
|
|
||||||
Path realPath = state.checkSourcePath(state.toRealPath(path, context));
|
Path realPath = state.checkSourcePath(state.toRealPath(path, context));
|
||||||
|
|
||||||
StorePath storePath = state.store->parseStorePath(path);
|
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
if (state.store->isStorePath(path) && state.store->isValidPath(storePath) && isDerivation(path)) {
|
auto isValidDerivationInStore = [&]() -> std::optional<StorePath> {
|
||||||
|
if (!state.store->isStorePath(path))
|
||||||
|
return std::nullopt;
|
||||||
|
auto storePath = state.store->parseStorePath(path);
|
||||||
|
if (!(state.store->isValidPath(storePath) && isDerivation(path)))
|
||||||
|
return std::nullopt;
|
||||||
|
return storePath;
|
||||||
|
};
|
||||||
|
if (auto optStorePath = isValidDerivationInStore()) {
|
||||||
|
auto storePath = *optStorePath;
|
||||||
Derivation drv = readDerivation(*state.store, realPath, std::string(storePath.name()));
|
Derivation drv = readDerivation(*state.store, realPath, std::string(storePath.name()));
|
||||||
Value & w = *state.allocValue();
|
Value & w = *state.allocValue();
|
||||||
state.mkAttrs(w, 3 + drv.outputs.size());
|
state.mkAttrs(w, 3 + drv.outputs.size());
|
||||||
|
|
Loading…
Reference in a new issue