aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval-settings.hh36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh
index c264b521f..98fe6881e 100644
--- a/src/libexpr/eval-settings.hh
+++ b/src/libexpr/eval-settings.hh
@@ -125,6 +125,42 @@ struct EvalSettings : Config
This is useful for debugging warnings in third-party Nix code.
)"};
+
+ PathsSetting replOverlays{this, Paths(), "repl-overlays",
+ R"(
+ A list of files containing Nix expressions that can be used to add
+ default bindings to [`nix
+ repl`](@docroot@/command-ref/new-cli/nix3-repl.md) sessions.
+
+ Each file is called with three arguments:
+ 1. An [attribute set](@docroot@/language/values.html#attribute-set)
+ containing at least a
+ [`currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem)
+ attribute (this is identical to
+ [`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem),
+ except that it's available in
+ [`pure-eval`](@docroot@/command-ref/conf-file.html#conf-pure-eval)
+ mode).
+ 2. The top-level bindings produced by the previous `repl-overlays`
+ value (or the default top-level bindings).
+ 3. The final top-level bindings produced by calling all
+ `repl-overlays`.
+
+ For example, the following file would alias `pkgs` to
+ `legacyPackages.${info.currentSystem}` (if that attribute is defined):
+
+ ```nix
+ info: final: prev:
+ if prev ? legacyPackages
+ && prev.legacyPackages ? ${info.currentSystem}
+ then
+ {
+ pkgs = prev.legacyPackages.${info.currentSystem};
+ }
+ else
+ { }
+ ```
+ )"};
};
extern EvalSettings evalSettings;