aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/common-eval-args.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/common-eval-args.cc')
-rw-r--r--src/libexpr/common-eval-args.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libexpr/common-eval-args.cc b/src/libexpr/common-eval-args.cc
index 13950ab8d..fc60954b4 100644
--- a/src/libexpr/common-eval-args.cc
+++ b/src/libexpr/common-eval-args.cc
@@ -3,6 +3,8 @@
#include "download.hh"
#include "util.hh"
#include "eval.hh"
+#include "fetchers/registry.hh"
+#include "flake/flakeref.hh"
namespace nix {
@@ -26,6 +28,26 @@ MixEvalArgs::MixEvalArgs()
.description("add a path to the list of locations used to look up <...> file names")
.label("path")
.handler([&](std::string s) { searchPath.push_back(s); });
+
+ mkFlag()
+ .longName("impure")
+ .description("allow access to mutable paths and repositories")
+ .handler([&](std::vector<std::string> ss) {
+ evalSettings.pureEval = false;
+ });
+
+ mkFlag()
+ .longName("override-flake")
+ .labels({"original-ref", "resolved-ref"})
+ .description("override a flake registry value")
+ .arity(2)
+ .handler([&](std::vector<std::string> ss) {
+ auto from = parseFlakeRef(ss[0], absPath("."));
+ auto to = parseFlakeRef(ss[1], absPath("."));
+ fetchers::Input::Attrs extraAttrs;
+ if (to.subdir != "") extraAttrs["dir"] = to.subdir;
+ fetchers::overrideRegistry(from.input, to.input, extraAttrs);
+ });
}
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)