aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéophane Hufschmitt <regnat@users.noreply.github.com>2021-12-14 10:35:37 +0100
committerGitHub <noreply@github.com>2021-12-14 10:35:37 +0100
commit8868da45a87699d6a0791a11a1a83d8a2c78cb24 (patch)
treea49c574151e714ecfc689f9f79afde19247540b2
parent99d617bcde8d1639f9eb86e9310274aee0b7c8c9 (diff)
parentbb8a53ab08c43425c6073aff5fe34bd5bc93dd13 (diff)
Merge pull request #5623 from yorickvP/fix-5621
flakes: fix boolean and int nixConfig values
-rw-r--r--src/libexpr/flake/config.cc8
-rw-r--r--src/libexpr/flake/flake.cc2
-rw-r--r--tests/flake-local-settings.sh1
3 files changed, 6 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 f598400fc..b15878d5c 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 (auto elem : setting.value->listItems()) {
diff --git a/tests/flake-local-settings.sh b/tests/flake-local-settings.sh
index 09f6b4ca8..98ad60174 100644
--- a/tests/flake-local-settings.sh
+++ b/tests/flake-local-settings.sh
@@ -18,6 +18,7 @@ chmod +x echoing-post-hook.sh
cat <<EOF > flake.nix
{
nixConfig.post-build-hook = "$PWD/echoing-post-hook.sh";
+ nixConfig.allow-dirty = false; # See #5621
outputs = a: {
defaultPackage.$system = import ./simple.nix;