Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
21 changes: 21 additions & 0 deletions nixos/doc/manual/man-nixos-version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<option>--revision</option>
</arg>

<arg>
<option>--configuration-revision</option>
</arg>

<arg>
<option>--json</option>
</arg>
Expand Down Expand Up @@ -118,6 +122,23 @@
</listitem>
</varlistentry>

<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>
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2305.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion nixos/modules/installer/tools/nixos-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of awful, but probably fine for now. I think nixos-version would make a good candidate for __structuredAttrs once #175649 lands in master.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also did not particularly like it - I am happy to take a look into __structuredAttrs - should this included in this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's fine. __structuredAttrs wouldn't really help anyway since the structured attrs are only available at build time.

echo "$0: configuration revision is unknown" >&2
exit 1
fi
echo "@configurationRevision@"
;;
--json)
cat <<EOF
@json@
Expand Down