nixos-version: Add --json flag and show system.configurationRevision
This commit is contained in:
parent
855fcc324a
commit
7e9b745174
@ -20,8 +20,14 @@
|
|||||||
<arg>
|
<arg>
|
||||||
<option>--revision</option>
|
<option>--revision</option>
|
||||||
</arg>
|
</arg>
|
||||||
|
|
||||||
|
<arg>
|
||||||
|
<option>--json</option>
|
||||||
|
</arg>
|
||||||
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
<para>
|
<para>
|
||||||
@ -84,12 +90,16 @@
|
|||||||
</variablelist>
|
</variablelist>
|
||||||
</para>
|
</para>
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>Options</title>
|
<title>Options</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This command accepts the following options:
|
This command accepts the following options:
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<option>--hash</option>
|
<option>--hash</option>
|
||||||
@ -107,6 +117,21 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<option>--json</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Print a JSON representation of the versions of NixOS and the
|
||||||
|
top-level configuration flake.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@ -8,6 +8,11 @@ case "$1" in
|
|||||||
--hash|--revision)
|
--hash|--revision)
|
||||||
echo "@revision@"
|
echo "@revision@"
|
||||||
;;
|
;;
|
||||||
|
--json)
|
||||||
|
cat <<EOF
|
||||||
|
{"nixosVersion": "@version@", "nixpkgsRevision": "@revision@", "configurationRevision": "@configurationRevision@"}
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "@version@ (@codeName@)"
|
echo "@version@ (@codeName@)"
|
||||||
;;
|
;;
|
||||||
|
@ -48,6 +48,7 @@ let
|
|||||||
name = "nixos-version";
|
name = "nixos-version";
|
||||||
src = ./nixos-version.sh;
|
src = ./nixos-version.sh;
|
||||||
inherit (config.system.nixos) version codeName revision;
|
inherit (config.system.nixos) version codeName revision;
|
||||||
|
inherit (config.system) configurationRevision;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-enter = makeProg {
|
nixos-enter = makeProg {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user