File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed
Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ Path Settings::getDefaultSSLCertFile()
242242 return " " ;
243243}
244244
245- const std::string nixVersion = PACKAGE_VERSION;
245+ std::string nixVersion = PACKAGE_VERSION;
246246
247247NLOHMANN_JSON_SERIALIZE_ENUM (SandboxMode, {
248248 {SandboxMode::smEnabled, true },
Original file line number Diff line number Diff line change @@ -1248,7 +1248,15 @@ void loadConfFile(AbstractConfig & config);
12481248// Used by the Settings constructor
12491249std::vector<Path> getUserConfigFiles ();
12501250
1251- extern const std::string nixVersion;
1251+ /* *
1252+ * The version of Nix itself.
1253+ *
1254+ * This is not `const`, so that the Nix CLI can provide a more detailed version
1255+ * number including the git revision, without having to "re-compile" the entire
1256+ * set of Nix libraries to include that version, even when those libraries are
1257+ * not affected by the change.
1258+ */
1259+ extern std::string nixVersion;
12521260
12531261/* *
12541262 * @param loadConfig Whether to load configuration from `nix.conf`, `NIX_CONFIG`, etc. May be disabled for unit tests.
Original file line number Diff line number Diff line change @@ -557,6 +557,8 @@ void mainWrapped(int argc, char * * argv)
557557
558558int main (int argc, char * * argv)
559559{
560+ // The CLI has a more detailed version than the libraries; see nixVersion.
561+ nix::nixVersion = NIX_CLI_VERSION;
560562#ifndef _WIN32
561563 // Increase the default stack size for the evaluator and for
562564 // libstdc++'s std::regex.
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ subdir('nix-meson-build-support/windows-version')
3535
3636configdata = configuration_data ()
3737
38+ # The CLI has a more detailed version string than the libraries; see `nixVersion`
39+ configdata.set_quoted(' NIX_CLI_VERSION' , meson .project_version())
40+
3841fs = import (' fs' )
3942
4043bindir = get_option (' bindir' )
Original file line number Diff line number Diff line change @@ -92,11 +92,11 @@ mkMesonExecutable (finalAttrs: {
9292 ] ;
9393
9494 preConfigure =
95- # "Inline" .version so it's not a symlink, and includes the suffix .
96- # Do the meson utils, without modification .
95+ # Update the repo-global .version file .
96+ # Symlink ./.version points there, but by default only workDir is writable .
9797 ''
9898 chmod u+w ./.version
99- echo ${ version } > ../../.. /.version
99+ echo ${ version } > ./.version
100100 '' ;
101101
102102 mesonFlags = [
You can’t perform that action at this time.
0 commit comments