about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/Makefile.am1
-rw-r--r--src/libmain/shared.cc3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libmain/Makefile.am b/src/libmain/Makefile.am
index a4969ff36777..6d70b0406acc 100644
--- a/src/libmain/Makefile.am
+++ b/src/libmain/Makefile.am
@@ -7,4 +7,5 @@ AM_CXXFLAGS = \
  -DNIX_DATA_DIR=\"$(datadir)\" \
  -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \
  -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \
+ -DNIX_VERSION=\"$(VERSION)\" \
  -I.. -I../../externals/inst/include -I../libutil -I../libstore
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index e91ef2667824..32f4f81240bb 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -70,6 +70,9 @@ static void initAndRun(int argc, char * * argv)
         else if (arg == "--help") {
             printHelp();
             return;
+        } else if (arg == "--version") {
+            cout << format("%1% (Nix) %2%") % programId % NIX_VERSION << endl;
+            return;
         } else if (arg == "--keep-failed" || arg == "-K")
             keepFailed = true;
         else remaining.push_back(arg);