Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libcmd/installable-attr-path.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "nix/cmd/installable-attr-path.hh"
#include "nix/util/eval-context.hh"
#include "nix/store/outputs-spec.hh"
#include "nix/util/util.hh"
#include "nix/cmd/command.hh"
Expand Down Expand Up @@ -36,6 +37,7 @@ std::pair<Value *, PosIdx> InstallableAttrPath::toValue(EvalState & state)

DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
{
EvalContextGuard ctx(fmt("during evaluation of attribute '%s'", attrPath));
auto [v, pos] = toValue(*state);

if (std::optional derivedPathWithInfo =
Expand Down
2 changes: 2 additions & 0 deletions src/libcmd/installable-flake.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "nix/cmd/installable-flake.hh"
#include "nix/util/eval-context.hh"
#include "nix/store/outputs-spec.hh"
#include "nix/util/util.hh"
#include "nix/cmd/command.hh"
Expand Down Expand Up @@ -66,6 +67,7 @@ InstallableFlake::InstallableFlake(

DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
{
EvalContextGuard ctx(fmt("during evaluation of installable '%s'", what()));
Activity act(*logger, lvlTalkative, actUnknown, fmt("evaluating derivation '%s'", what()));

auto attr = getCursor(*state);
Expand Down
5 changes: 5 additions & 0 deletions src/libcmd/installables.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "nix/store/globals.hh"
#include "nix/cmd/installables.hh"
#include "nix/util/eval-context.hh"
#include "nix/cmd/installable-derived-path.hh"
#include "nix/cmd/installable-attr-path.hh"
#include "nix/cmd/installable-flake.hh"
Expand Down Expand Up @@ -461,6 +462,10 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
auto state = getEvalState();
auto vFile = state->allocValue();

EvalContextGuard ctx(
expr ? fmt("during evaluation of expression '%s'", *expr)
: fmt("during evaluation of file '%s'", file->string()));

if (file == "-") {
auto e = state->parseStdin();
state->eval(e, *vFile);
Expand Down
3 changes: 3 additions & 0 deletions src/libcmd/repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <memory>

#include "nix/util/error.hh"
#include "nix/util/eval-context.hh"
#include "nix/cmd/repl-interacter.hh"
#include "nix/cmd/repl.hh"

Expand Down Expand Up @@ -688,6 +689,7 @@ ProcessLineResult NixRepl::processLine(std::string line)

void NixRepl::loadFile(const std::filesystem::path & path)
{
EvalContextGuard ctx(fmt("during loading of '%s'", path.string()));
Value v, v2;
state->evalFile(lookupFileArg(*state, path.string()), v);
state->autoCallFunction(*autoArgs, v, v2);
Expand Down Expand Up @@ -905,6 +907,7 @@ ExprAttrs * NixRepl::parseReplBindings(std::string s)

void NixRepl::evalString(std::string s, Value & v)
{
EvalContextGuard ctx(fmt("during evaluation of REPL expression '%s'", s));
Expr * e = parseString(s);
e->eval(*state, *env, v);
state->forceValue(v, v.determinePos(noPos));
Expand Down
Loading
Loading