Skip to content

Commit 13d573b

Browse files
committed
WIP get settings info out of headers, out of libutil
1 parent 9300f85 commit 13d573b

25 files changed

+184
-65
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/libmain/config-upstream.cc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace nix {
2+
3+
#include "fs-sink.hh"
4+
#include "logging.hh"
5+
6+
struct LoggerSettings : Config
7+
{
8+
Setting<bool> showTrace{
9+
this, false, "show-trace",
10+
R"(
11+
Whether Nix should print out a stack trace in case of Nix
12+
expression evaluation errors.
13+
)"};
14+
};
15+
16+
static GlobalConfig::Register r1(&restoreSinkSettings);
17+
18+
struct RestoreSinkSettings : Config
19+
{
20+
Setting<bool> preallocateContents{this, false, "preallocate-contents",
21+
"Whether to preallocate files when writing objects with known size."};
22+
};
23+
24+
static GlobalConfig::Register rLoggerSettings(&loggerSettings);
25+
26+
struct ArchiveSettings : Config
27+
{
28+
Setting<bool> useCaseHack{this,
29+
#if __APPLE__
30+
true,
31+
#else
32+
false,
33+
#endif
34+
"use-case-hack",
35+
"Whether to enable a Darwin-specific hack for dealing with file name collisions."};
36+
};
37+
38+
static GlobalConfig::Register rArchiveSettings(&archiveSettings);
39+
40+
}

src/libutil/config.cc renamed to src/libmain/config.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -452,26 +452,4 @@ void OptionalPathSetting::operator =(const std::optional<Path> & v)
452452
this->assign(v);
453453
}
454454

455-
bool ExperimentalFeatureSettings::isEnabled(const ExperimentalFeature & feature) const
456-
{
457-
auto & f = experimentalFeatures.get();
458-
return std::find(f.begin(), f.end(), feature) != f.end();
459-
}
460-
461-
void ExperimentalFeatureSettings::require(const ExperimentalFeature & feature) const
462-
{
463-
if (!isEnabled(feature))
464-
throw MissingExperimentalFeature(feature);
465-
}
466-
467-
bool ExperimentalFeatureSettings::isEnabled(const std::optional<ExperimentalFeature> & feature) const
468-
{
469-
return !feature || isEnabled(*feature);
470-
}
471-
472-
void ExperimentalFeatureSettings::require(const std::optional<ExperimentalFeature> & feature) const
473-
{
474-
if (feature) require(*feature);
475-
}
476-
477455
}

src/libutil/config.hh renamed to src/libmain/config.hh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,6 @@ public:
257257
, documentDefault(documentDefault)
258258
{ }
259259

260-
operator const T &() const { return value; }
261-
operator T &() { return value; }
262-
const T & get() const { return value; }
263260
template<typename U>
264261
bool operator ==(const U & v2) const { return value == v2; }
265262
template<typename U>

0 commit comments

Comments
 (0)