about summary refs log tree commit diff
path: root/tools/nixery/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-06-16T14·52+0300
committerclbot <clbot@tvl.fyi>2022-06-16T15·08+0000
commitac10907913b713403194021c1d68cb34a1d68a19 (patch)
tree51b83c80bee27666a74d704d0db660f1c53248d5 /tools/nixery/default.nix
parent15a9aad6584e7922dbff029f9eebaa1928ea99c5 (diff)
docs(nixery): dynamically display current nixpkgs commit r/4241
People occasionally ask what the current nixpkgs commit is on
nixery.dev (see e.g. https://github.com/tazjin/nixery/issues/153).

With this change, the commit is displayed on nixery.dev if Nixery is
built for the TVL deployment.

Change-Id: I795220214db5a367a126c9b4bd03754e9f144940
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5881
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tools/nixery/default.nix')
-rw-r--r--tools/nixery/default.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/nixery/default.nix b/tools/nixery/default.nix
index 3c9e50cac0cc..1b1715cf9fcc 100644
--- a/tools/nixery/default.nix
+++ b/tools/nixery/default.nix
@@ -19,7 +19,7 @@
 with pkgs;
 
 let
-  inherit (pkgs) buildGoModule;
+  inherit (pkgs) buildGoModule lib;
 
   # Avoid extracting this from git until we have a way to plumb
   # through revision numbers.
@@ -33,7 +33,23 @@ depot.nix.readTree.drvTargets rec {
   # Use mdBook to build a static asset page which Nixery can then
   # serve. This is primarily used for the public instance at
   # nixery.dev.
-  nixery-book = callPackage ./docs { };
+  #
+  # If the nixpkgs commit is known, append it to the main docs page.
+  nixery-book = callPackage ./docs {
+    postamble = lib.optionalString (pkgs ? nixpkgsCommits.unstable) ''
+      ### Which revision of `nixpkgs` is used for the builds?
+
+      The current revision of `nixpkgs` is
+      [`${pkgs.nixpkgsCommits.unstable}`][commit] from the
+      `nixos-unstable` channel.
+
+      This instance of Nixery uses the `nixpkgs` channel pinned by TVL
+      in [`//third_party/sources/sources.json`][sources].
+
+      [commit]: https://github.com/NixOS/nixpkgs/commit/${pkgs.nixpkgsCommits.unstable}
+      [sources]: https://code.tvl.fyi/tree/third_party/sources/sources.json
+    '';
+  };
 
   nixery-popcount = callPackage ./popcount { };