libmain/shared: factor out nix features
This way, other parts of the codebase can use it. Change-Id: I58673a6a56362692980426a6c8f70f5c6aff24d4 Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "lix/libutil/terminal.hh"
|
||||
#include "lix/libutil/strings.hh"
|
||||
#include "lix/libutil/exit.hh"
|
||||
#include "lix/libutil/compile-time-features.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
@@ -302,14 +303,9 @@ bool LegacyArgs::processArgs(const Strings & args, bool finish)
|
||||
void printVersion(const std::string & programName)
|
||||
{
|
||||
std::cout << fmt("%1% (Lix, like Nix) %2%", programName, nixVersion) << std::endl;
|
||||
Strings cfg;
|
||||
#if HAVE_BOEHMGC
|
||||
cfg.push_back("gc");
|
||||
#endif
|
||||
cfg.push_back("signed-caches");
|
||||
std::cout << "System type: " << settings.thisSystem << "\n";
|
||||
std::cout << "Additional system types: " << concatStringsSep(", ", settings.extraPlatforms.get()) << "\n";
|
||||
std::cout << "Features: " << concatStringsSep(", ", cfg) << "\n";
|
||||
std::cout << "Features: " << concatStringsSep(", ", getNixFeatures()) << "\n";
|
||||
std::cout << "System configuration file: " << settings.nixConfDir + "/nix.conf" << "\n";
|
||||
std::cout << "User configuration files: " <<
|
||||
concatStringsSep(":", settings.nixUserConfFiles)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "lix/libutil/types.hh"
|
||||
|
||||
namespace nix {
|
||||
/**
|
||||
* This returns a list of compile-time features.
|
||||
*
|
||||
* Historically, `signed-caches` seemed to have been one.
|
||||
* So we include it always.
|
||||
*
|
||||
* NOTE: There's no guarantee that the output will be stable
|
||||
* across Lix versions.
|
||||
*/
|
||||
constexpr Strings getNixFeatures()
|
||||
{
|
||||
Strings features = {"signed-caches"};
|
||||
|
||||
#if HAVE_BOEHMGC
|
||||
features.push_back("gc");
|
||||
#endif
|
||||
|
||||
return features;
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@ libutil_headers = files(
|
||||
'chunked-vector.hh',
|
||||
'closure.hh',
|
||||
'comparator.hh',
|
||||
'compile-time-features.hh',
|
||||
'compression.hh',
|
||||
'compute-levels.hh',
|
||||
'concepts.hh',
|
||||
|
||||
Reference in New Issue
Block a user