From 3a9753132ee36825a2d84813b75cd486b62d873e Mon Sep 17 00:00:00 2001 From: regnat Date: Wed, 9 Jun 2021 20:44:51 +0200 Subject: [PATCH] Make the derivation check more lazy --- src/nix/search.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nix/search.cc b/src/nix/search.cc index b865073ad..928f11fea 100644 --- a/src/nix/search.cc +++ b/src/nix/search.cc @@ -9,6 +9,7 @@ #include "shared.hh" #include "eval-cache.hh" #include "attr-path.hh" +#include "value.hh" #include #include @@ -100,7 +101,10 @@ struct CmdSearch : InstallableCommand, MixJSON }; try { - if (state->isDerivation(current)) { + auto maybeTypeField = state->lazyGetAttrField(current, {state->sType}, noPos, *vTmp); + if (maybeTypeField == EvalState::LazyValueType::PlainValue + && vTmp->type() == nix::nString + && strcmp(vTmp->string.s, "derivation") == 0) { size_t found = 0; state->getAttrFieldThrow(current, {state->sName}, noPos, *vTmp);