aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorMatej Urbas <matej.urbas@gmail.com>2023-04-30 09:56:24 +0100
committerMatej Urbas <matej.urbas@gmail.com>2023-05-07 20:22:18 +0100
commit613bc699bb72d32c7d0622bf2996b2ecc8012455 (patch)
treeced1d97b8d86ad4e14135204ab4a0bcee6c6b146 /src/libstore/globals.cc
parent89d3cc5a47a448f624ea4c9b43eeee00dcc88a21 (diff)
`max-substitution-jobs` setting
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 4c66d08ee..46b14cc98 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -249,6 +249,17 @@ unsigned int MaxBuildJobsSetting::parse(const std::string & str) const
}
}
+unsigned int MaxSubstitutionJobsSetting::parse(const std::string & str) const
+{
+ if (str == "auto") return std::max(1U, std::thread::hardware_concurrency());
+ else {
+ if (auto n = string2Int<decltype(value)>(str))
+ return std::max(1U, *n);
+ else
+ throw UsageError("configuration setting '%s' should be 'auto' or an integer", name);
+ }
+}
+
Paths PluginFilesSetting::parse(const std::string & str) const
{