aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-28 11:34:34 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-28 11:34:34 -0500
commitd12f57c2c0ef32180875aa4a0b803c838a7d988f (patch)
tree2c046d98bc0bd9171881ff0b6d56fa89c7c642e6 /src/libcmd/repl.hh
parentc36b584f8eb103afa152ef4304cf9fd5c3ebaaf0 (diff)
parent4489def1b36aeaee2254159efc1c21c868cc8585 (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'src/libcmd/repl.hh')
-rw-r--r--src/libcmd/repl.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/libcmd/repl.hh b/src/libcmd/repl.hh
new file mode 100644
index 000000000..dfccc93e7
--- /dev/null
+++ b/src/libcmd/repl.hh
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "eval.hh"
+
+#if HAVE_BOEHMGC
+#define GC_INCLUDE_NEW
+#include <gc/gc_cpp.h>
+#endif
+
+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(
+ const Strings & searchPath, nix::ref<Store> store, ref<EvalState> state,
+ std::function<AnnotatedValues()> getValues);
+
+ static void runSimple(
+ ref<EvalState> evalState,
+ const ValMap & extraEnv);
+
+ virtual void initEnv() = 0;
+
+ virtual void mainLoop() = 0;
+};
+
+}