diff options
author | Michael Lohmann <michael.lohmann@bevuta.com> | 2021-02-06 18:32:26 +0100 |
---|---|---|
committer | Michael Lohmann <michael.lohmann@bevuta.com> | 2023-01-03 20:40:35 +0100 |
commit | c09f6c3db0207702d95f966236c975a49beb29ee (patch) | |
tree | 5781a5ad01989611e1859bd072f7e355935c9e69 | |
parent | 54360cca52b85451a09f4909bbb445aa22e3eff8 (diff) | |
download | nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar.gz nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar.bz2 nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar.lz nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar.xz nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.tar.zst nixpkgs-c09f6c3db0207702d95f966236c975a49beb29ee.zip |
nixos-version: output configurationRevision
`nixos-version --configuration-revision` will show the configurationRevision.
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2305.section.xml | 7 | ||||
-rw-r--r-- | nixos/doc/manual/man-nixos-version.xml | 21 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2305.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-version.sh | 7 |
4 files changed, 37 insertions, 0 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml index 4fb5749e71c..91b23685f6e 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml @@ -486,6 +486,13 @@ <literal>libax25</literal> package. </para> </listitem> + <listitem> + <para> + <literal>nixos-version</literal> now accepts + <literal>--configuration-revision</literal> to display more + information about the current generation revision + </para> + </listitem> </itemizedlist> </section> </section> diff --git a/nixos/doc/manual/man-nixos-version.xml b/nixos/doc/manual/man-nixos-version.xml index fae25721e39..507c5035ed8 100644 --- a/nixos/doc/manual/man-nixos-version.xml +++ b/nixos/doc/manual/man-nixos-version.xml @@ -22,6 +22,10 @@ </arg> <arg> + <option>--configuration-revision</option> + </arg> + + <arg> <option>--json</option> </arg> @@ -120,6 +124,23 @@ <varlistentry> <term> + <option>--configuration-revision</option> + </term> + <listitem> + <para> + Show the configuration revision if available. This could be the full SHA1 + hash of the Git commit of the system flake, if you add + <screen>{ system.configurationRevision = self.rev or "dirty"; }</screen> + to the <screen>modules</screen> array of your flake.nix system configuration e.g. +<screen><prompt>$ </prompt>nixos-version --configuration-revision +aa314ebd1592f6cdd53cb5bba8bcae97d9323de8 +</screen> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term> <option>--json</option> </term> <listitem> diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index b5c9c4ceb55..00c5337df85 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -128,3 +128,5 @@ In addition to numerous new and upgraded packages, this release has the followin - The new option `services.tailscale.useRoutingFeatures` controls various settings for using Tailscale features like exit nodes and subnet routers. If you wish to use your machine as an exit node, you can set this setting to `server`, otherwise if you wish to use an exit node you can set this setting to `client`. The strict RPF warning has been removed as the RPF will be loosened automatically based on the value of this setting. - [Xastir](https://xastir.org/index.php/Main_Page) can now access AX.25 interfaces via the `libax25` package. + +- `nixos-version` now accepts `--configuration-revision` to display more information about the current generation revision diff --git a/nixos/modules/installer/tools/nixos-version.sh b/nixos/modules/installer/tools/nixos-version.sh index 59a9c572b41..8727cd2f876 100644 --- a/nixos/modules/installer/tools/nixos-version.sh +++ b/nixos/modules/installer/tools/nixos-version.sh @@ -13,6 +13,13 @@ case "$1" in fi echo "@revision@" ;; + --configuration-revision) + if [[ "@configurationRevision@" =~ "@" ]]; then + echo "$0: configuration revision is unknown" >&2 + exit 1 + fi + echo "@configurationRevision@" + ;; --json) cat <<EOF @json@ |