mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Restore detailed Nix CLI version
... as intended.
Requirements:
- don't build fresh libraries for each git commit
- have git commit in the CLI
Bug:
- echo ${version} went into the wrong file => use the fact that it's
a symlink, not just for reading but also for writing.
(cherry picked from commit bba4e6b061
)
This commit is contained in:
parent
d6a66b366e
commit
21998464b7
5 changed files with 19 additions and 5 deletions
|
@ -242,7 +242,7 @@ Path Settings::getDefaultSSLCertFile()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string nixVersion = PACKAGE_VERSION;
|
std::string nixVersion = PACKAGE_VERSION;
|
||||||
|
|
||||||
NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
|
NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
|
||||||
{SandboxMode::smEnabled, true},
|
{SandboxMode::smEnabled, true},
|
||||||
|
|
|
@ -1248,7 +1248,15 @@ void loadConfFile(AbstractConfig & config);
|
||||||
// Used by the Settings constructor
|
// Used by the Settings constructor
|
||||||
std::vector<Path> getUserConfigFiles();
|
std::vector<Path> getUserConfigFiles();
|
||||||
|
|
||||||
extern const std::string nixVersion;
|
/**
|
||||||
|
* The version of Nix itself.
|
||||||
|
*
|
||||||
|
* This is not `const`, so that the Nix CLI can provide a more detailed version
|
||||||
|
* number including the git revision, without having to "re-compile" the entire
|
||||||
|
* set of Nix libraries to include that version, even when those libraries are
|
||||||
|
* not affected by the change.
|
||||||
|
*/
|
||||||
|
extern std::string nixVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param loadConfig Whether to load configuration from `nix.conf`, `NIX_CONFIG`, etc. May be disabled for unit tests.
|
* @param loadConfig Whether to load configuration from `nix.conf`, `NIX_CONFIG`, etc. May be disabled for unit tests.
|
||||||
|
|
|
@ -557,6 +557,9 @@ void mainWrapped(int argc, char * * argv)
|
||||||
|
|
||||||
int main(int argc, char * * argv)
|
int main(int argc, char * * argv)
|
||||||
{
|
{
|
||||||
|
// The CLI has a more detailed version than the libraries; see nixVersion.
|
||||||
|
nix::nixVersion = NIX_CLI_VERSION;
|
||||||
|
|
||||||
// Increase the default stack size for the evaluator and for
|
// Increase the default stack size for the evaluator and for
|
||||||
// libstdc++'s std::regex.
|
// libstdc++'s std::regex.
|
||||||
nix::setStackSize(64 * 1024 * 1024);
|
nix::setStackSize(64 * 1024 * 1024);
|
||||||
|
|
|
@ -35,6 +35,9 @@ subdir('nix-meson-build-support/windows-version')
|
||||||
|
|
||||||
configdata = configuration_data()
|
configdata = configuration_data()
|
||||||
|
|
||||||
|
# The CLI has a more detailed version string than the libraries; see `nixVersion`
|
||||||
|
configdata.set_quoted('NIX_CLI_VERSION', meson.project_version())
|
||||||
|
|
||||||
fs = import('fs')
|
fs = import('fs')
|
||||||
|
|
||||||
bindir = get_option('bindir')
|
bindir = get_option('bindir')
|
||||||
|
|
|
@ -92,11 +92,11 @@ mkMesonExecutable (finalAttrs: {
|
||||||
];
|
];
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
# "Inline" .version so it's not a symlink, and includes the suffix.
|
# Update the repo-global .version file.
|
||||||
# Do the meson utils, without modification.
|
# Symlink ./.version points there, but by default only workDir is writable.
|
||||||
''
|
''
|
||||||
chmod u+w ./.version
|
chmod u+w ./.version
|
||||||
echo ${version} > ../../../.version
|
echo ${version} > ./.version
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mesonFlags = [
|
mesonFlags = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue