diff --git a/.version-determinate b/.version-determinate new file mode 100644 index 000000000..d3827e75a --- /dev/null +++ b/.version-determinate @@ -0,0 +1 @@ +1.0 diff --git a/package.nix b/package.nix index e1b4aebb0..ac196ef90 100644 --- a/package.nix +++ b/package.nix @@ -158,6 +158,7 @@ in { fileset = fileset.intersection baseFiles (fileset.unions ([ # For configure ./.version + ./.version-determinate ./configure.ac ./m4 # TODO: do we really need README.md? It doesn't seem used in the build. diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 59e1e48b7..65d8b661b 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -294,7 +294,7 @@ void parseCmdLine(const std::string & programName, const Strings & args, void printVersion(const std::string & programName) { - std::cout << fmt("%1% (Determinate Nix) %2%", programName, nixVersion) << std::endl; + std::cout << fmt("%s (Determinate Nix %s) %s", programName, determinateNixVersion, nixVersion) << std::endl; if (verbosity > lvlInfo) { Strings cfg; #if HAVE_BOEHMGC diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 439a6f97c..89b79141c 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -273,6 +273,8 @@ Path Settings::getDefaultSSLCertFile() const std::string nixVersion = PACKAGE_VERSION; +const std::string determinateNixVersion = DETERMINATE_NIX_VERSION; + NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, { {SandboxMode::smEnabled, true}, {SandboxMode::smRelaxed, "relaxed"}, diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 8760c9d14..6c66b5795 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -1247,6 +1247,8 @@ std::vector getUserConfigFiles(); extern const std::string nixVersion; +extern const std::string determinateNixVersion; + /** * @param loadConfig Whether to load configuration from `nix.conf`, `NIX_CONFIG`, etc. May be disabled for unit tests. * @note When using libexpr, and/or libmain, This is not sufficient. See initNix(). diff --git a/src/libstore/local.mk b/src/libstore/local.mk index 5dc8f3370..c138ed0a8 100644 --- a/src/libstore/local.mk +++ b/src/libstore/local.mk @@ -73,7 +73,8 @@ libstore_CXXFLAGS += \ -DNIX_CONF_DIR=\"$(NIX_ROOT)$(sysconfdir)/nix\" \ -DNIX_BIN_DIR=\"$(NIX_ROOT)$(bindir)\" \ -DNIX_MAN_DIR=\"$(NIX_ROOT)$(mandir)\" \ - -DLSOF=\"$(NIX_ROOT)$(lsof)\" + -DLSOF=\"$(NIX_ROOT)$(lsof)\" \ + -DDETERMINATE_NIX_VERSION=\""$(shell cat ./.version-determinate)"\" ifeq ($(embedded_sandbox_shell),yes) libstore_CXXFLAGS += -DSANDBOX_SHELL=\"__embedded_sandbox_shell__\" diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 50b15e15d..196400d09 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -12,6 +12,8 @@ project('nix-store', 'cpp', license : 'LGPL-2.1-or-later', ) +fs = import('fs') + cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') @@ -21,6 +23,8 @@ configdata = configuration_data() # TODO rename, because it will conflict with downstream projects configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) +configdata.set_quoted('DETERMINATE_NIX_VERSION', fs.read('./.version-determinate')) + configdata.set_quoted('SYSTEM', host_machine.system()) deps_private_maybe_subproject = [ @@ -320,8 +324,6 @@ else subdir('unix') endif -fs = import('fs') - prefix = get_option('prefix') # For each of these paths, assume that it is relative to the prefix unless # it is already an absolute path (which is the default for store-dir, state-dir, and log-dir).