Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::NixRepl Struct Reference
Inheritance diagram for nix::NixRepl:
nix::AbstractNixRepl nix::detail::ReplCompleterMixin nix::NeverAsync

Public Member Functions

 NixRepl (const SearchPath &searchPath, nix::ref< Store > store, EvalState &state, std::function< AnnotatedValues()> getValues)
ReplExitStatus mainLoop () override
void initEnv () override
virtual StringSet completePrefix (const std::string &prefix) override
StorePath getDerivationPath (Value &v)
ProcessLineResult processLine (std::string line)
void loadFile (const Path &path)
void loadFlake (const std::string &flakeRef)
void loadFiles ()
void reloadFiles ()
template<typename T, typename NameFn, typename ValueFn>
void addToScope (T &&things, NameFn nameFn, ValueFn valueFn)
void addAttrsToScope (Value &attrs)
void addValMapToScope (const ValMap &attrs)
void addVarToScope (const Symbol name, Value &v)
ExprparseString (std::string s)
std::variant< std::unique_ptr< Expr >, ExprReplBindingsparseReplString (std::string s)
void evalString (std::string s, Value &v)
void loadDebugTraceEnv (const DebugTrace &dt)
void loadReplOverlays ()
ValuereplOverlays ()
ValuegetReplOverlaysEvalFunction ()
ValuereplInitInfo ()
ValuebindingsToAttrs ()
ValueevalFile (SourcePath &path)
void printValue (std::ostream &str, Value &v, unsigned int maxDepth=std::numeric_limits< unsigned int >::max())

Public Attributes

Evaluatorevaluator
size_t debugTraceIndex
Strings loadedFiles
std::function< AnnotatedValues()> getValues
std::shared_ptr< StaticEnvstaticEnv
Envenv
int displ
StringSet varNames
box_ptr< ReplInteracterinteracter
std::shared_ptr< Value * > replOverlaysEvalFunction

Static Public Attributes

static constexpr std::array COMMANDS
static constexpr std::array DEBUG_COMMANDS
static const int envSize = 1 << 20

Additional Inherited Members

Public Types inherited from nix::AbstractNixRepl
typedef std::vector< std::pair< Value *, std::string > > AnnotatedValues
Static Public Member Functions inherited from nix::AbstractNixRepl
static ReplExitStatus run (const SearchPath &searchPath, nix::ref< Store > store, EvalState &state, std::function< AnnotatedValues()> getValues, const ValMap &extraEnv, Bindings *autoArgs)
static ReplExitStatus runSimple (EvalState &evalState, const ValMap &extraEnv)
Protected Member Functions inherited from nix::AbstractNixRepl
 AbstractNixRepl (EvalState &state)
Protected Attributes inherited from nix::AbstractNixRepl
EvalStatestate
BindingsautoArgs

Member Function Documentation

◆ bindingsToAttrs()

Value * nix::NixRepl::bindingsToAttrs ( )

Get the current top-level bindings as an AttrSet.

◆ completePrefix()

StringSet nix::NixRepl::completePrefix ( const std::string & prefix)
overridevirtual

◆ evalFile()

Value * nix::NixRepl::evalFile ( SourcePath & path)

Parse a file, evaluate its result, and force the resulting value.

◆ getDerivationPath()

StorePath nix::NixRepl::getDerivationPath ( Value & v)
Exceptions
nix::Errorthrown directly if the expression does not evaluate to a derivation, or evaluates to an invalid derivation.

◆ getReplOverlaysEvalFunction()

Value * nix::NixRepl::getReplOverlaysEvalFunction ( )

Get the Nix function that composes the repl-overlays together.

◆ initEnv()

void nix::NixRepl::initEnv ( )
overridevirtual

Implements nix::AbstractNixRepl.

◆ loadReplOverlays()

void nix::NixRepl::loadReplOverlays ( )

Load the repl-overlays and add the resulting AttrSet to the top-level bindings.

◆ mainLoop()

ReplExitStatus nix::NixRepl::mainLoop ( )
overridevirtual

Implements nix::AbstractNixRepl.

◆ replInitInfo()

Value * nix::NixRepl::replInitInfo ( )

Get the info AttrSet that's passed as the first argument to each of the repl-overlays.

◆ replOverlays()

Value * nix::NixRepl::replOverlays ( )

Get a list of each of the repl-overlays (parsed and evaluated).

Member Data Documentation

◆ COMMANDS

std::array nix::NixRepl::COMMANDS
staticconstexpr
Initial value:
= {
"add"sv, "a"sv,
"load"sv, "l"sv,
"load-flake"sv, "lf"sv,
"reload"sv, "r"sv,
"edit"sv, "e"sv,
"t"sv,
"u"sv,
"b"sv,
"bl"sv,
"i"sv,
"sh"sv,
"log"sv,
"print"sv, "p"sv,
"quit"sv, "q"sv,
"doc"sv,
"te"sv,
}

◆ DEBUG_COMMANDS

std::array nix::NixRepl::DEBUG_COMMANDS
staticconstexpr
Initial value:
= {
"env"sv,
"bt"sv, "backtrace"sv,
"st"sv,
"c"sv, "continue"sv,
"s"sv, "step"sv,
}

◆ replOverlaysEvalFunction

std::shared_ptr<Value *> nix::NixRepl::replOverlaysEvalFunction
Initial value:
=
std::allocate_shared<Value *>(TraceableAllocator<Value *>(), nullptr)

Cached return value of getReplOverlaysEvalFunction.

Note: This is shared_ptr to avoid garbage collection.


The documentation for this struct was generated from the following file:
  • lix/libcmd/repl.cc