diff options
author | Naïm Favier <n@monade.li> | 2023-01-12 12:31:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 12:31:54 +0100 |
commit | 7e1cf498703f19802e78275c9462f5621ae20703 (patch) | |
tree | 5b8d42b190c6134925822a699ba28adb74041dca | |
parent | 23e2f33e5234bec07a7a0db95b7c2695802cb8ca (diff) | |
parent | 3b5456608a680a0cf7e488c7ddd250b6fef3eac1 (diff) |
Merge pull request #161237 from miallo/nixos-version-configuration-revision
-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 | 9 |
4 files changed, 38 insertions, 1 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 518a89688b95..242841a56b65 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 @@ -517,6 +517,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 fae25721e394..507c5035ed8d 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 312ff3463039..b5c74836ef40 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -136,3 +136,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 59a9c572b418..39e34a3718cb 100644 --- a/nixos/modules/installer/tools/nixos-version.sh +++ b/nixos/modules/installer/tools/nixos-version.sh @@ -8,11 +8,18 @@ case "$1" in ;; --hash|--revision) if ! [[ @revision@ =~ ^[0-9a-f]+$ ]]; then - echo "$0: Nixpkgs commit hash is unknown" + echo "$0: Nixpkgs commit hash is unknown" >&2 exit 1 fi echo "@revision@" ;; + --configuration-revision) + if [[ "@configurationRevision@" =~ "@" ]]; then + echo "$0: configuration revision is unknown" >&2 + exit 1 + fi + echo "@configurationRevision@" + ;; --json) cat <<EOF @json@ |