aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2021-11-22 13:29:49 +0100
committerYorick van Pelt <yorick@yorickvanpelt.nl>2021-11-29 15:53:22 +0100
commitbd628cf3da14b7d3fe0ba00932eb26d545b4b893 (patch)
treeb63ae52ab83ef9d550ee6691ed1eea0dcbf30fca /src/libexpr/flake
parent9cd8cffefc65fe425c6aa07aa3bc67a8eec46087 (diff)
flakes: fix boolean and int nixConfig values
Some type confusion was causing ints to be pointers, and bools to be ints. Fixes #5621
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/config.cc8
-rw-r--r--src/libexpr/flake/flake.cc2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/flake/config.cc b/src/libexpr/flake/config.cc
index c03f4106c..7ecd61816 100644
--- a/src/libexpr/flake/config.cc
+++ b/src/libexpr/flake/config.cc
@@ -38,11 +38,11 @@ void ConfigFile::apply()
// FIXME: Move into libutil/config.cc.
std::string valueS;
- if (auto s = std::get_if<std::string>(&value))
+ if (auto* s = std::get_if<std::string>(&value))
valueS = *s;
- else if (auto n = std::get_if<int64_t>(&value))
- valueS = fmt("%d", n);
- else if (auto b = std::get_if<Explicit<bool>>(&value))
+ else if (auto* n = std::get_if<int64_t>(&value))
+ valueS = fmt("%d", *n);
+ else if (auto* b = std::get_if<Explicit<bool>>(&value))
valueS = b->t ? "true" : "false";
else if (auto ss = std::get_if<std::vector<std::string>>(&value))
valueS = concatStringsSep(" ", *ss); // FIXME: evil
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index f5be67d67..732198031 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -254,7 +254,7 @@ static Flake getFlake(
else if (setting.value->type() == nInt)
flake.config.settings.insert({setting.name, state.forceInt(*setting.value, *setting.pos)});
else if (setting.value->type() == nBool)
- flake.config.settings.insert({setting.name, state.forceBool(*setting.value, *setting.pos)});
+ flake.config.settings.insert({setting.name, Explicit<bool> { state.forceBool(*setting.value, *setting.pos) }});
else if (setting.value->type() == nList) {
std::vector<std::string> ss;
for (unsigned int n = 0; n < setting.value->listSize(); ++n) {