2023-02-04 05:42:36 +02:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2023-02-04 05:42:36 +02:00
|
|
|
|
|
|
|
#include "eval.hh"
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
struct AbstractNixRepl
|
|
|
|
{
|
|
|
|
ref<EvalState> state;
|
|
|
|
Bindings * autoArgs;
|
|
|
|
|
|
|
|
AbstractNixRepl(ref<EvalState> state)
|
|
|
|
: state(state)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual ~AbstractNixRepl()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
typedef std::vector<std::pair<Value*,std::string>> AnnotatedValues;
|
|
|
|
|
|
|
|
static std::unique_ptr<AbstractNixRepl> create(
|
2023-06-23 20:51:25 +03:00
|
|
|
const SearchPath & searchPath, nix::ref<Store> store, ref<EvalState> state,
|
2023-02-04 05:42:36 +02:00
|
|
|
std::function<AnnotatedValues()> getValues);
|
|
|
|
|
2024-02-03 04:53:49 +02:00
|
|
|
static ReplExitStatus runSimple(
|
2023-02-04 05:42:36 +02:00
|
|
|
ref<EvalState> evalState,
|
|
|
|
const ValMap & extraEnv);
|
|
|
|
|
|
|
|
virtual void initEnv() = 0;
|
|
|
|
|
2024-02-03 04:53:49 +02:00
|
|
|
virtual ReplExitStatus mainLoop() = 0;
|
2023-02-04 05:42:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|