diff --git a/lix/libmain/shared.cc b/lix/libmain/shared.cc index c466f2841..6fdd27377 100644 --- a/lix/libmain/shared.cc +++ b/lix/libmain/shared.cc @@ -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 #include @@ -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) diff --git a/lix/libutil/compile-time-features.hh b/lix/libutil/compile-time-features.hh new file mode 100644 index 000000000..392dbd679 --- /dev/null +++ b/lix/libutil/compile-time-features.hh @@ -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; +} +} diff --git a/lix/libutil/meson.build b/lix/libutil/meson.build index d5ab3c6f2..b5f882b8b 100644 --- a/lix/libutil/meson.build +++ b/lix/libutil/meson.build @@ -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',