diff --git a/nixos/doc/manual/man-nixos-version.xml b/nixos/doc/manual/man-nixos-version.xml
index e9ad8bddcac..aada08c5b4a 100644
--- a/nixos/doc/manual/man-nixos-version.xml
+++ b/nixos/doc/manual/man-nixos-version.xml
@@ -12,16 +12,22 @@
- nixos-version
+ nixos-version
-
+
+
+
+
+
+
+
Description
@@ -84,12 +90,16 @@
+
Options
+
This command accepts the following options:
+
+
@@ -107,6 +117,21 @@
+
+
+
+
+
+
+
+ Print a JSON representation of the versions of NixOS and the
+ top-level configuration flake.
+
+
+
+
+
+
diff --git a/nixos/modules/installer/tools/nixos-version.sh b/nixos/modules/installer/tools/nixos-version.sh
index 190c49a33ec..0117aa1549c 100644
--- a/nixos/modules/installer/tools/nixos-version.sh
+++ b/nixos/modules/installer/tools/nixos-version.sh
@@ -8,6 +8,11 @@ case "$1" in
--hash|--revision)
echo "@revision@"
;;
+ --json)
+ cat <