1.Dd January 1, 1980
2.Dt nixos-version 8
3.Os
4.Sh NAME
5.Nm nixos-version
6.Nd show the NixOS version
7.
8.
9.
10.Sh SYNOPSIS
11.Nm nixos-version
12.Op Fl -hash
13.Op Fl -revision
14.Op Fl -configuration-revision
15.Op Fl -json
16.
17.
18.
19.Sh DESCRIPTION
20This command shows the version of the currently active NixOS configuration. For example:
21.Bd -literal -offset indent
22$ nixos-version
2316.03.1011.6317da4 (Emu)
24.Ed
25.
26.Pp
27The version consists of the following elements:
28.Bl -tag -width indent
29.It Ql 16.03
30The NixOS release, indicating the year and month in which it was released
31(e.g. March 2016).
32.It Ql 1011
33The number of commits in the Nixpkgs Git repository between the start of the
34release branch and the commit from which this version was built. This ensures
35that NixOS versions are monotonically increasing. It is
36.Ql git
37when the current NixOS configuration was built from a checkout of the Nixpkgs
38Git repository rather than from a NixOS channel.
39.It Ql 6317da4
40The first 7 characters of the commit in the Nixpkgs Git repository from which
41this version was built.
42.It Ql Emu
43The code name of the NixOS release. The first letter of the code name indicates
44that this is the N'th stable NixOS release; for example, Emu is the fifth
45release.
46.El
47.
48.
49.
50.Sh OPTIONS
51.Bl -tag -width indent
52.It Fl -hash , -revision
53Show the full SHA1 hash of the Git commit from which this configuration was
54built, e.g.
55.Bd -literal -offset indent
56$ nixos-version --hash
576317da40006f6bc2480c6781999c52d88dde2acf
58.Ed
59.
60.It Fl -configuration-revision
61Show the configuration revision if available. This could be the full SHA1 hash
62of the Git commit of the system flake, if you add
63.Bd -literal -offset indent
64{ system.configurationRevision = self.rev or "dirty"; }
65.Ed
66.Pp
67to the
68.Ql modules
69array of your flake.nix system configuration e.g.
70.Bd -literal -offset indent
71$ nixos-version --configuration-revision
72aa314ebd1592f6cdd53cb5bba8bcae97d9323de8
73.Ed
74.
75.It Fl -json
76Print a JSON representation of the versions of NixOS and the top-level
77configuration flake.
78.El
79.
80.
81.
82.Sh AUTHORS
83.An -nosplit
84.An Eelco Dolstra
85and
86.An the Nixpkgs/NixOS contributors