aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval-settings.hh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 07:21:01 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 07:21:01 +0100
commit7614aa97975f3e6e36b6ffbd9fec34462021ab39 (patch)
treeebb2521607d7b5a30fadcc13e0af889159d5af2e /src/libexpr/eval-settings.hh
parent64a269ef73b111d49037812bd899b5cb883158ef (diff)
Merge pull request #4093 from matthewbauer/eval-system
Add eval-system option (cherry picked from commit 071dbbee33af9f27338c3e53e4ea067dbfa14010) Change-Id: Ia81358c8cfb60241da07a4d0e84b9ee62a18a53f
Diffstat (limited to 'src/libexpr/eval-settings.hh')
-rw-r--r--src/libexpr/eval-settings.hh20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh
index 19122bc31..049f42e70 100644
--- a/src/libexpr/eval-settings.hh
+++ b/src/libexpr/eval-settings.hh
@@ -25,6 +25,26 @@ struct EvalSettings : Config
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath).
)"};
+ Setting<std::string> currentSystem{
+ this, "", "eval-system",
+ R"(
+ This option defines
+ [`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem)
+ in the Nix language if it is set as a non-empty string.
+ Otherwise, if it is defined as the empty string (the default), the value of the
+ [`system` ](#conf-system)
+ configuration setting is used instead.
+
+ Unlike `system`, this setting does not change what kind of derivations can be built locally.
+ This is useful for evaluating Nix code on one system to produce derivations to be built on another type of system.
+ )"};
+
+ /**
+ * Implements the `eval-system` vs `system` defaulting logic
+ * described for `eval-system`.
+ */
+ const std::string & getCurrentSystem();
+
Setting<bool> restrictEval{
this, false, "restrict-eval",
R"(