summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2022-04-23 06:06:16 +0300
committerGitHub <noreply@github.com>2022-04-23 06:06:16 +0300
commit62866bc35264510ec4a9cc67b84759db64417ac9 (patch)
tree8c629c1a488308274d07732cfc98c61abf3a16b3
parent747594d85322e7395839d58c7aae3c8c90bfa817 (diff)
parent41808d42d21f685e3fd3cdb2c9f04082f0818e30 (diff)
downloadnixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar.gz
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar.bz2
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar.lz
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar.xz
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.tar.zst
nixpkgs-62866bc35264510ec4a9cc67b84759db64417ac9.zip
Merge pull request #169449 from Artturin/movetesting1
testers.testVersion: move from trivial-builders.nix
-rw-r--r--doc/builders/fetchers.chapter.md2
-rw-r--r--doc/builders/special.xml1
-rw-r--r--doc/builders/special/invalidateFetcherByDrvHash.section.md31
-rw-r--r--doc/builders/testers.chapter.md82
-rw-r--r--doc/manual.xml1
-rw-r--r--pkgs/applications/audio/furnace/default.nix4
-rw-r--r--pkgs/applications/audio/whipper/default.nix4
-rw-r--r--pkgs/applications/graphics/ImageMagick/7.0.nix4
-rw-r--r--pkgs/applications/misc/dunst/default.nix4
-rw-r--r--pkgs/applications/misc/hello/default.nix3
-rw-r--r--pkgs/applications/misc/k4dirstat/default.nix4
-rw-r--r--pkgs/applications/misc/sigi/default.nix4
-rw-r--r--pkgs/applications/misc/zola/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/palemoon/default.nix4
-rw-r--r--pkgs/applications/networking/cluster/ocm/default.nix4
-rw-r--r--pkgs/applications/networking/cluster/odo/default.nix4
-rw-r--r--pkgs/applications/networking/cluster/openshift/default.nix4
-rw-r--r--pkgs/applications/networking/mailreaders/notmuch/default.nix4
-rw-r--r--pkgs/applications/networking/seaweedfs/default.nix4
-rw-r--r--pkgs/applications/science/logic/key/default.nix5
-rw-r--r--pkgs/applications/version-management/git-and-tools/git-machete/default.nix2
-rw-r--r--pkgs/applications/version-management/git-and-tools/scmpuff/default.nix4
-rw-r--r--pkgs/applications/version-management/git-sizer/default.nix4
-rw-r--r--pkgs/applications/version-management/jujutsu/default.nix4
-rw-r--r--pkgs/applications/video/handbrake/default.nix4
-rw-r--r--pkgs/applications/virtualization/podman-tui/default.nix4
-rw-r--r--pkgs/build-support/testers/default.nix16
-rw-r--r--pkgs/build-support/testers/test-equal-derivation.nix17
-rw-r--r--pkgs/build-support/trivial-builders.nix37
-rw-r--r--pkgs/development/compilers/go-jsonnet/default.nix4
-rw-r--r--pkgs/development/compilers/uasm/default.nix4
-rw-r--r--pkgs/development/python-modules/mutmut/default.nix4
-rw-r--r--pkgs/development/python-modules/staticjinja/default.nix4
-rw-r--r--pkgs/development/quickemu/default.nix4
-rw-r--r--pkgs/development/tools/amazon-qldb-shell/default.nix4
-rw-r--r--pkgs/development/tools/bingo/default.nix4
-rw-r--r--pkgs/development/tools/buf/default.nix4
-rw-r--r--pkgs/development/tools/fq/default.nix4
-rw-r--r--pkgs/development/tools/gojq/default.nix4
-rw-r--r--pkgs/development/tools/kube-linter/default.nix4
-rw-r--r--pkgs/development/tools/quick-lint-js/default.nix4
-rw-r--r--pkgs/development/tools/selenium/chromedriver/default.nix4
-rw-r--r--pkgs/development/tools/sq/default.nix4
-rw-r--r--pkgs/development/tools/yarn/default.nix4
-rw-r--r--pkgs/games/lgogdownloader/default.nix4
-rw-r--r--pkgs/games/opensupaplex/default.nix4
-rw-r--r--pkgs/games/warzone2100/default.nix4
-rw-r--r--pkgs/servers/monitoring/prometheus/promscale/default.nix4
-rw-r--r--pkgs/servers/stayrtr/default.nix4
-rw-r--r--pkgs/tools/admin/colmena/default.nix4
-rw-r--r--pkgs/tools/archivers/7zz/default.nix4
-rw-r--r--pkgs/tools/backup/discordchatexporter-cli/default.nix4
-rw-r--r--pkgs/tools/compression/pxz/default.nix4
-rw-r--r--pkgs/tools/filesystems/garage/default.nix4
-rw-r--r--pkgs/tools/misc/adrgen/default.nix4
-rw-r--r--pkgs/tools/misc/arch-install-scripts/default.nix1
-rw-r--r--pkgs/tools/misc/czkawka/default.nix4
-rw-r--r--pkgs/tools/misc/datefmt/default.nix4
-rw-r--r--pkgs/tools/misc/dsq/default.nix4
-rw-r--r--pkgs/tools/misc/gummy/default.nix4
-rw-r--r--pkgs/tools/misc/lsd/default.nix4
-rw-r--r--pkgs/tools/misc/zellij/default.nix4
-rw-r--r--pkgs/tools/networking/clash/default.nix4
-rw-r--r--pkgs/tools/networking/curlie/default.nix4
-rw-r--r--pkgs/tools/networking/innernet/default.nix6
-rw-r--r--pkgs/tools/networking/pmacct/default.nix4
-rw-r--r--pkgs/tools/networking/smartdns/default.nix4
-rw-r--r--pkgs/tools/nix/alejandra/default.nix4
-rw-r--r--pkgs/tools/system/s-tui/default.nix4
-rw-r--r--pkgs/tools/text/crowdin-cli/default.nix4
-rw-r--r--pkgs/tools/text/difftastic/default.nix4
-rw-r--r--pkgs/tools/text/igrep/default.nix4
-rw-r--r--pkgs/tools/text/mdbook-linkcheck/default.nix4
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix4
75 files changed, 229 insertions, 220 deletions
diff --git a/doc/builders/fetchers.chapter.md b/doc/builders/fetchers.chapter.md
index d9f22b06282..09a41cd9ce0 100644
--- a/doc/builders/fetchers.chapter.md
+++ b/doc/builders/fetchers.chapter.md
@@ -6,7 +6,7 @@ When using Nix, you will frequently need to download source code and other files
 
 Because fixed output derivations are _identified_ by their hash, a common mistake is to update a fetcher's URL or a version parameter, without updating the hash. **This will cause the old contents to be used.** So remember to always invalidate the hash argument.
 
-For those who develop and maintain fetchers, a similar problem arises with changes to the implementation of a fetcher. These may cause a fixed output derivation to fail, but won't normally be caught by tests because the supposed output is already in the store or cache. For the purpose of testing, you can use a trick that is embodied by the [`invalidateFetcherByDrvHash`](#sec-pkgs-invalidateFetcherByDrvHash) function. It uses the derivation `name` to create a unique output path per fetcher implementation, defeating the caching precisely where it would be harmful.
+For those who develop and maintain fetchers, a similar problem arises with changes to the implementation of a fetcher. These may cause a fixed output derivation to fail, but won't normally be caught by tests because the supposed output is already in the store or cache. For the purpose of testing, you can use a trick that is embodied by the [`invalidateFetcherByDrvHash`](#tester-invalidateFetcherByDrvHash) function. It uses the derivation `name` to create a unique output path per fetcher implementation, defeating the caching precisely where it would be harmful.
 
 ## `fetchurl` and `fetchzip` {#fetchurl}
 
diff --git a/doc/builders/special.xml b/doc/builders/special.xml
index 2f84599cdd4..8902ce5c813 100644
--- a/doc/builders/special.xml
+++ b/doc/builders/special.xml
@@ -7,5 +7,4 @@
  </para>
  <xi:include href="special/fhs-environments.section.xml" />
  <xi:include href="special/mkshell.section.xml" />
- <xi:include href="special/invalidateFetcherByDrvHash.section.xml" />
 </chapter>
diff --git a/doc/builders/special/invalidateFetcherByDrvHash.section.md b/doc/builders/special/invalidateFetcherByDrvHash.section.md
deleted file mode 100644
index 7c2f03a64b7..00000000000
--- a/doc/builders/special/invalidateFetcherByDrvHash.section.md
+++ /dev/null
@@ -1,31 +0,0 @@
-
-## `invalidateFetcherByDrvHash` {#sec-pkgs-invalidateFetcherByDrvHash}
-
-Use the derivation hash to invalidate the output via name, for testing.
-
-Type: `(a@{ name, ... } -> Derivation) -> a -> Derivation`
-
-Normally, fixed output derivations can and should be cached by their output
-hash only, but for testing we want to re-fetch everytime the fetcher changes.
-
-Changes to the fetcher become apparent in the drvPath, which is a hash of
-how to fetch, rather than a fixed store path.
-By inserting this hash into the name, we can make sure to re-run the fetcher
-every time the fetcher changes.
-
-This relies on the assumption that Nix isn't clever enough to reuse its
-database of local store contents to optimize fetching.
-
-You might notice that the "salted" name derives from the normal invocation,
-not the final derivation. `invalidateFetcherByDrvHash` has to invoke the fetcher
-function twice: once to get a derivation hash, and again to produce the final
-fixed output derivation.
-
-Example:
-
-    tests.fetchgit = invalidateFetcherByDrvHash fetchgit {
-      name = "nix-source";
-      url = "https://github.com/NixOS/nix";
-      rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
-      sha256 = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
-    };
diff --git a/doc/builders/testers.chapter.md b/doc/builders/testers.chapter.md
new file mode 100644
index 00000000000..2c30c8bd240
--- /dev/null
+++ b/doc/builders/testers.chapter.md
@@ -0,0 +1,82 @@
+# Testers {#chap-testers}
+This chapter describes several testing builders which are available in the <literal>testers</literal> namespace.
+
+## `testVersion` {#tester-testVersion}
+
+Checks the command output contains the specified version
+
+Although simplistic, this test assures that the main program
+can run. While there's no substitute for a real test case,
+it does catch dynamic linking errors and such. It also provides
+some protection against accidentally building the wrong version,
+for example when using an 'old' hash in a fixed-output derivation.
+
+Examples:
+
+```nix
+passthru.tests.version = testVersion { package = hello; };
+
+passthru.tests.version = testVersion {
+  package = seaweedfs;
+  command = "weed version";
+};
+
+passthru.tests.version = testVersion {
+  package = key;
+  command = "KeY --help";
+  # Wrong '2.5' version in the code. Drop on next version.
+  version = "2.5";
+};
+```
+
+## `testEqualDerivation` {#tester-testEqualDerivation}
+
+Checks that two packages produce the exact same build instructions.
+
+This can be used to make sure that a certain difference of configuration,
+such as the presence of an overlay does not cause a cache miss.
+
+When the derivations are equal, the return value is an empty file.
+Otherwise, the build log explains the difference via `nix-diff`.
+
+Example:
+
+```nix
+testEqualDerivation
+  "The hello package must stay the same when enabling checks."
+  hello
+  (hello.overrideAttrs(o: { doCheck = true; }))
+```
+
+## `invalidateFetcherByDrvHash` {#tester-invalidateFetcherByDrvHash}
+
+Use the derivation hash to invalidate the output via name, for testing.
+
+Type: `(a@{ name, ... } -> Derivation) -> a -> Derivation`
+
+Normally, fixed output derivations can and should be cached by their output
+hash only, but for testing we want to re-fetch everytime the fetcher changes.
+
+Changes to the fetcher become apparent in the drvPath, which is a hash of
+how to fetch, rather than a fixed store path.
+By inserting this hash into the name, we can make sure to re-run the fetcher
+every time the fetcher changes.
+
+This relies on the assumption that Nix isn't clever enough to reuse its
+database of local store contents to optimize fetching.
+
+You might notice that the "salted" name derives from the normal invocation,
+not the final derivation. `invalidateFetcherByDrvHash` has to invoke the fetcher
+function twice: once to get a derivation hash, and again to produce the final
+fixed output derivation.
+
+Example:
+
+```nix
+tests.fetchgit = invalidateFetcherByDrvHash fetchgit {
+  name = "nix-source";
+  url = "https://github.com/NixOS/nix";
+  rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
+  sha256 = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
+};
+```
diff --git a/doc/manual.xml b/doc/manual.xml
index e49ae67ec94..ccbaf40586d 100644
--- a/doc/manual.xml
+++ b/doc/manual.xml
@@ -25,6 +25,7 @@
   <title>Builders</title>
   <xi:include href="builders/fetchers.chapter.xml" />
   <xi:include href="builders/trivial-builders.chapter.xml" />
+  <xi:include href="builders/testers.chapter.xml" />
   <xi:include href="builders/special.xml" />
   <xi:include href="builders/images.xml" />
   <xi:include href="hooks/index.xml" />
diff --git a/pkgs/applications/audio/furnace/default.nix b/pkgs/applications/audio/furnace/default.nix
index 841a65e541f..115c5b7767d 100644
--- a/pkgs/applications/audio/furnace/default.nix
+++ b/pkgs/applications/audio/furnace/default.nix
@@ -1,7 +1,7 @@
 { stdenv
 , lib
 , gitUpdater
-, testVersion
+, testers
 , furnace
 , fetchFromGitHub
 , cmake
@@ -83,7 +83,7 @@ stdenv.mkDerivation rec {
       inherit pname version;
       rev-prefix = "v";
     };
-    tests.version = testVersion {
+    tests.version = testers.testVersion {
       package = furnace;
       # The command always exits with code 1
       command = "(furnace --version || [ $? -eq 1 ])";
diff --git a/pkgs/applications/audio/whipper/default.nix b/pkgs/applications/audio/whipper/default.nix
index 7b76d91acf8..f06907ad32f 100644
--- a/pkgs/applications/audio/whipper/default.nix
+++ b/pkgs/applications/audio/whipper/default.nix
@@ -8,7 +8,7 @@
 , flac
 , sox
 , util-linux
-, testVersion
+, testers
 , whipper
 }:
 
@@ -74,7 +74,7 @@ in python3.pkgs.buildPythonApplication rec {
     runHook postCheck
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = whipper;
     command = "HOME=$TMPDIR whipper --version";
   };
diff --git a/pkgs/applications/graphics/ImageMagick/7.0.nix b/pkgs/applications/graphics/ImageMagick/7.0.nix
index 48008c36933..74a60857a6a 100644
--- a/pkgs/applications/graphics/ImageMagick/7.0.nix
+++ b/pkgs/applications/graphics/ImageMagick/7.0.nix
@@ -29,7 +29,7 @@
 , curl
 , ApplicationServices
 , Foundation
-, testVersion
+, testers
 , imagemagick
 }:
 
@@ -120,7 +120,7 @@ stdenv.mkDerivation rec {
   '';
 
   passthru.tests.version =
-    testVersion { package = imagemagick; };
+    testers.testVersion { package = imagemagick; };
 
   meta = with lib; {
     homepage = "http://www.imagemagick.org/";
diff --git a/pkgs/applications/misc/dunst/default.nix b/pkgs/applications/misc/dunst/default.nix
index 116d5430c2a..6afd9ee6242 100644
--- a/pkgs/applications/misc/dunst/default.nix
+++ b/pkgs/applications/misc/dunst/default.nix
@@ -3,7 +3,7 @@
 , cairo, dbus, systemd, gdk-pixbuf, glib, libX11, libXScrnSaver
 , wayland, wayland-protocols
 , libXinerama, libnotify, pango, xorgproto, librsvg
-, testVersion, dunst
+, testers, dunst
 }:
 
 stdenv.mkDerivation rec {
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
       --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
   '';
 
-  passthru.tests.version = testVersion { package = dunst; };
+  passthru.tests.version = testers.testVersion { package = dunst; };
 
   meta = with lib; {
     description = "Lightweight and customizable notification daemon";
diff --git a/pkgs/applications/misc/hello/default.nix b/pkgs/applications/misc/hello/default.nix
index ecb78928217..60482a84c9b 100644
--- a/pkgs/applications/misc/hello/default.nix
+++ b/pkgs/applications/misc/hello/default.nix
@@ -2,7 +2,6 @@
 , stdenv
 , fetchurl
 , nixos
-, testVersion
 , testers
 , hello
 }:
@@ -19,7 +18,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   passthru.tests = {
-    version = testVersion { package = hello; };
+    version = testers.testVersion { package = hello; };
 
     invariant-under-noXlibs =
       testers.testEqualDerivation
diff --git a/pkgs/applications/misc/k4dirstat/default.nix b/pkgs/applications/misc/k4dirstat/default.nix
index e2e43ae0997..552a63240d5 100644
--- a/pkgs/applications/misc/k4dirstat/default.nix
+++ b/pkgs/applications/misc/k4dirstat/default.nix
@@ -7,7 +7,7 @@
 , kjobwidgets
 , kxmlgui
 , lib
-, testVersion
+, testers
 , k4dirstat
 }:
 
@@ -26,7 +26,7 @@ mkDerivation rec {
   buildInputs = [ kiconthemes kio kjobwidgets kxmlgui ];
 
   passthru.tests.version =
-    testVersion {
+    testers.testVersion {
       package = k4dirstat;
       command = "k4dirstat -platform offscreen --version &>/dev/stdout";
     };
diff --git a/pkgs/applications/misc/sigi/default.nix b/pkgs/applications/misc/sigi/default.nix
index 2513476ad74..ff74d8b098f 100644
--- a/pkgs/applications/misc/sigi/default.nix
+++ b/pkgs/applications/misc/sigi/default.nix
@@ -1,4 +1,4 @@
-{ lib, rustPlatform, fetchCrate, installShellFiles, testVersion, sigi }:
+{ lib, rustPlatform, fetchCrate, installShellFiles, testers, sigi }:
 
 rustPlatform.buildRustPackage rec {
   pname = "sigi";
@@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {
     installManPage sigi.1
   '';
 
-  passthru.tests.version = testVersion { package = sigi; };
+  passthru.tests.version = testers.testVersion { package = sigi; };
 
   meta = with lib; {
     description = "Organizing CLI for people who don't love organizing.";
diff --git a/pkgs/applications/misc/zola/default.nix b/pkgs/applications/misc/zola/default.nix
index f6ed2daf8ec..24511096f1d 100644
--- a/pkgs/applications/misc/zola/default.nix
+++ b/pkgs/applications/misc/zola/default.nix
@@ -10,7 +10,7 @@
 , installShellFiles
 , libsass
 , zola
-, testVersion
+, testers
 }:
 
 rustPlatform.buildRustPackage rec {
@@ -48,7 +48,7 @@ rustPlatform.buildRustPackage rec {
       --bash completions/zola.bash
   '';
 
-  passthru.tests.version = testVersion { package = zola; };
+  passthru.tests.version = testers.testVersion { package = zola; };
 
   meta = with lib; {
     description = "A fast static site generator with everything built-in";
diff --git a/pkgs/applications/networking/browsers/palemoon/default.nix b/pkgs/applications/networking/browsers/palemoon/default.nix
index 70442e47e66..eacc66271d5 100644
--- a/pkgs/applications/networking/browsers/palemoon/default.nix
+++ b/pkgs/applications/networking/browsers/palemoon/default.nix
@@ -31,7 +31,7 @@
 , zip
 , zlib
 , withGTK3 ? true, gtk3, gtk2
-, testVersion
+, testers
 , palemoon
 }:
 
@@ -211,7 +211,7 @@ stdenv.mkDerivation rec {
       )"
       update-source-version ${pname} "$version"
     '';
-    tests.version = testVersion {
+    tests.version = testers.testVersion {
       package = palemoon;
     };
   };
diff --git a/pkgs/applications/networking/cluster/ocm/default.nix b/pkgs/applications/networking/cluster/ocm/default.nix
index 1bacd8510dc..73a5d964f34 100644
--- a/pkgs/applications/networking/cluster/ocm/default.nix
+++ b/pkgs/applications/networking/cluster/ocm/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, ocm }:
+{ lib, buildGoModule, fetchFromGitHub, testers, ocm }:
 
 buildGoModule rec {
   pname = "ocm";
@@ -18,7 +18,7 @@ buildGoModule rec {
     ln -s $GOPATH/bin/ocm ocm
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = ocm;
     command = "ocm version";
   };
diff --git a/pkgs/applications/networking/cluster/odo/default.nix b/pkgs/applications/networking/cluster/odo/default.nix
index be85981f7bf..fb1888d6235 100644
--- a/pkgs/applications/networking/cluster/odo/default.nix
+++ b/pkgs/applications/networking/cluster/odo/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, odo }:
+{ lib, buildGoModule, fetchFromGitHub, testers, odo }:
 
 buildGoModule rec {
   pname = "odo";
@@ -22,7 +22,7 @@ buildGoModule rec {
     cp -a odo $out/bin
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = odo;
     command = "odo version";
     version = "v${version}";
diff --git a/pkgs/applications/networking/cluster/openshift/default.nix b/pkgs/applications/networking/cluster/openshift/default.nix
index aade6c549f3..bab73c41f5f 100644
--- a/pkgs/applications/networking/cluster/openshift/default.nix
+++ b/pkgs/applications/networking/cluster/openshift/default.nix
@@ -4,7 +4,7 @@
 , libkrb5
 , git
 , installShellFiles
-, testVersion
+, testers
 , openshift
 }:
 
@@ -52,7 +52,7 @@ buildGoModule rec {
     installShellCompletion --zsh contrib/completions/zsh/*
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = openshift;
     command = "oc version";
     version = "v${version}";
diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix
index e89216802e5..18e09326f35 100644
--- a/pkgs/applications/networking/mailreaders/notmuch/default.nix
+++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix
@@ -6,7 +6,7 @@
 , pythonPackages
 , emacs
 , ruby
-, testVersion
+, testers
 , which, dtach, openssl, bash, gdb, man
 , withEmacs ? true
 , withRuby ? true
@@ -102,7 +102,7 @@ stdenv.mkDerivation rec {
 
   passthru = {
     pythonSourceRoot = "notmuch-${version}/bindings/python";
-    tests.version = testVersion { package = notmuch; };
+    tests.version = testers.testVersion { package = notmuch; };
     inherit version;
   };
 
diff --git a/pkgs/applications/networking/seaweedfs/default.nix b/pkgs/applications/networking/seaweedfs/default.nix
index cbabc6b10c7..bd6df5ef6be 100644
--- a/pkgs/applications/networking/seaweedfs/default.nix
+++ b/pkgs/applications/networking/seaweedfs/default.nix
@@ -1,7 +1,7 @@
 { lib
 , fetchFromGitHub
 , buildGoModule
-, testVersion
+, testers
 , seaweedfs
 }:
 
@@ -21,7 +21,7 @@ buildGoModule rec {
   subPackages = [ "weed" ];
 
   passthru.tests.version =
-    testVersion { package = seaweedfs; command = "weed version"; };
+    testers.testVersion { package = seaweedfs; command = "weed version"; };
 
   meta = with lib; {
     description = "Simple and highly scalable distributed file system";
diff --git a/pkgs/applications/science/logic/key/default.nix b/pkgs/applications/science/logic/key/default.nix
index 85a7ecb08c3..aee1a9c63f8 100644
--- a/pkgs/applications/science/logic/key/default.nix
+++ b/pkgs/applications/science/logic/key/default.nix
@@ -7,7 +7,7 @@
 , makeWrapper
 , makeDesktopItem
 , copyDesktopItems
-, testVersion
+, testers
 , key
 }:
 
@@ -98,7 +98,7 @@ in stdenv.mkDerivation rec {
   '';
 
   passthru.tests.version =
-    testVersion {
+    testers.testVersion {
       package = key;
       command = "KeY --help";
     };
@@ -118,4 +118,3 @@ in stdenv.mkDerivation rec {
     platforms = platforms.all;
   };
 }
-
diff --git a/pkgs/applications/version-management/git-and-tools/git-machete/default.nix b/pkgs/applications/version-management/git-and-tools/git-machete/default.nix
index 573f69fef00..bed96493e51 100644
--- a/pkgs/applications/version-management/git-and-tools/git-machete/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-machete/default.nix
@@ -4,7 +4,7 @@
 , installShellFiles
 , git
 , nix-update-script
-, testVersion
+, testers
 , git-machete
 }:
 
diff --git a/pkgs/applications/version-management/git-and-tools/scmpuff/default.nix b/pkgs/applications/version-management/git-and-tools/scmpuff/default.nix
index 3396718edbc..65ca1b476d4 100644
--- a/pkgs/applications/version-management/git-and-tools/scmpuff/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/scmpuff/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, scmpuff }:
+{ lib, buildGoModule, fetchFromGitHub, testers, scmpuff }:
 
 buildGoModule rec {
   pname = "scmpuff";
@@ -15,7 +15,7 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" "-X main.VERSION=${version}" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = scmpuff;
     command = "scmpuff version";
   };
diff --git a/pkgs/applications/version-management/git-sizer/default.nix b/pkgs/applications/version-management/git-sizer/default.nix
index daabe71bebb..ed7239b80cb 100644
--- a/pkgs/applications/version-management/git-sizer/default.nix
+++ b/pkgs/applications/version-management/git-sizer/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, git-sizer }:
+{ lib, buildGoModule, fetchFromGitHub, testers, git-sizer }:
 
 buildGoModule rec {
   pname = "git-sizer";
@@ -17,7 +17,7 @@ buildGoModule rec {
 
   doCheck = false;
 
-  passthru.tests.vesion = testVersion {
+  passthru.tests.vesion = testers.testVersion {
     package = git-sizer;
   };
 
diff --git a/pkgs/applications/version-management/jujutsu/default.nix b/pkgs/applications/version-management/jujutsu/default.nix
index 30ea7e1524a..c99bb409c3e 100644
--- a/pkgs/applications/version-management/jujutsu/default.nix
+++ b/pkgs/applications/version-management/jujutsu/default.nix
@@ -9,7 +9,7 @@
 , Security
 , SystemConfiguration
 , libiconv
-, testVersion
+, testers
 , jujutsu
 }:
 
@@ -44,7 +44,7 @@ rustPlatform.buildRustPackage rec {
   ];
 
   passthru.tests = {
-    version = testVersion {
+    version = testers.testVersion {
       package = jujutsu;
       command = "jj --version";
     };
diff --git a/pkgs/applications/video/handbrake/default.nix b/pkgs/applications/video/handbrake/default.nix
index 841604399ed..3c73e7f5994 100644
--- a/pkgs/applications/video/handbrake/default.nix
+++ b/pkgs/applications/video/handbrake/default.nix
@@ -11,7 +11,7 @@
 , lib
 , fetchFromGitHub
   # For tests
-, testVersion
+, testers
 , runCommand
 , fetchurl
   # Main build tools
@@ -230,7 +230,7 @@ let self = stdenv.mkDerivation rec {
         HandBrakeCLI -i ${testMkv} -o test.mkv -e x264 -q 20 -B 160
         test -e test.mkv
       '';
-    version = testVersion { package = self; command = "HandBrakeCLI --version"; };
+    version = testers.testVersion { package = self; command = "HandBrakeCLI --version"; };
   };
 
   meta = with lib; {
diff --git a/pkgs/applications/virtualization/podman-tui/default.nix b/pkgs/applications/virtualization/podman-tui/default.nix
index 17272acd86e..6feeb17256a 100644
--- a/pkgs/applications/virtualization/podman-tui/default.nix
+++ b/pkgs/applications/virtualization/podman-tui/default.nix
@@ -6,7 +6,7 @@
 , gpgme
 , libassuan
 , lvm2
-, testVersion
+, testers
 , podman-tui
 }:
 buildGoModule rec {
@@ -33,7 +33,7 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = podman-tui;
     command = "podman-tui version";
     version = "v${version}";
diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix
index 1d1effa3730..8b79843b833 100644
--- a/pkgs/build-support/testers/default.nix
+++ b/pkgs/build-support/testers/default.nix
@@ -1,4 +1,18 @@
-{ pkgs, lib, callPackage }:
+{ pkgs, lib, callPackage, runCommand }:
+# Documentation is in doc/builders/testers.chapter.md
 {
   testEqualDerivation = callPackage ./test-equal-derivation.nix { };
+
+  testVersion =
+    { package,
+      command ? "${package.meta.mainProgram or package.pname or package.name} --version",
+      version ? package.version,
+    }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
+      if output=$(${command} 2>&1); then
+        grep -Fw "${version}" - <<< "$output"
+        touch $out
+      else
+        echo "$output" >&2 && exit 1
+      fi
+    '';
 }
diff --git a/pkgs/build-support/testers/test-equal-derivation.nix b/pkgs/build-support/testers/test-equal-derivation.nix
index 652f3716b2a..610d5f58557 100644
--- a/pkgs/build-support/testers/test-equal-derivation.nix
+++ b/pkgs/build-support/testers/test-equal-derivation.nix
@@ -1,22 +1,5 @@
 { lib, runCommand, emptyFile, nix-diff }:
 
-/*
-  Checks that two packages produce the exact same build instructions.
-
-  This can be used to make sure that a certain difference of configuration,
-  such as the presence of an overlay does not cause a cache miss.
-
-  When the derivations are equal, the return value is an empty file.
-  Otherwise, the build log explains the difference via `nix-diff`.
-
-  Example:
-
-      testEqualDerivation
-        "The hello package must stay the same when enabling checks."
-        hello
-        (hello.overrideAttrs(o: { doCheck = true; }))
-
-*/
 assertion: a: b:
 let
   drvA = builtins.unsafeDiscardOutputDependency a.drvPath or (throw "testEqualDerivation second argument must be a package");
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix
index 1f9543f808e..bd14971fe78 100644
--- a/pkgs/build-support/trivial-builders.nix
+++ b/pkgs/build-support/trivial-builders.nix
@@ -784,41 +784,4 @@ rec {
     outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
     preferLocalBuild = true;
   } "mkdir $out";
-
-  /* Checks the command output contains the specified version
-   *
-   * Although simplistic, this test assures that the main program
-   * can run. While there's no substitute for a real test case,
-   * it does catch dynamic linking errors and such. It also provides
-   * some protection against accidentally building the wrong version,
-   * for example when using an 'old' hash in a fixed-output derivation.
-   *
-   * Examples:
-   *
-   * passthru.tests.version = testVersion { package = hello; };
-   *
-   * passthru.tests.version = testVersion {
-   *   package = seaweedfs;
-   *   command = "weed version";
-   * };
-   *
-   * passthru.tests.version = testVersion {
-   *   package = key;
-   *   command = "KeY --help";
-   *   # Wrong '2.5' version in the code. Drop on next version.
-   *   version = "2.5";
-   * };
-   */
-  testVersion =
-    { package,
-      command ? "${package.meta.mainProgram or package.pname or package.name} --version",
-      version ? package.version,
-    }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
-      if output=$(${command} 2>&1); then
-        grep -Fw "${version}" - <<< "$output"
-        touch $out
-      else
-        echo "$output" >&2 && exit 1
-      fi
-    '';
 }
diff --git a/pkgs/development/compilers/go-jsonnet/default.nix b/pkgs/development/compilers/go-jsonnet/default.nix
index 25bedd397b2..3c4d90ccb05 100644
--- a/pkgs/development/compilers/go-jsonnet/default.nix
+++ b/pkgs/development/compilers/go-jsonnet/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion }:
+{ lib, buildGoModule, fetchFromGitHub, testers }:
 
 let self = buildGoModule rec {
   pname = "go-jsonnet";
@@ -17,7 +17,7 @@ let self = buildGoModule rec {
 
   subPackages = [ "cmd/jsonnet*" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = self;
     version = "v${version}";
   };
diff --git a/pkgs/development/compilers/uasm/default.nix b/pkgs/development/compilers/uasm/default.nix
index 7356175c87c..2c8d6eb21ae 100644
--- a/pkgs/development/compilers/uasm/default.nix
+++ b/pkgs/development/compilers/uasm/default.nix
@@ -2,7 +2,7 @@
 , stdenv
 , fetchFromGitHub
 , fetchpatch
-, testVersion
+, testers
 , uasm
 }:
 
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = uasm;
     command = "uasm -h";
     version = "v${version}";
diff --git a/pkgs/development/python-modules/mutmut/default.nix b/pkgs/development/python-modules/mutmut/default.nix
index ae0f06213a8..626c768f2a8 100644
--- a/pkgs/development/python-modules/mutmut/default.nix
+++ b/pkgs/development/python-modules/mutmut/default.nix
@@ -7,7 +7,7 @@
 , pony
 , junit-xml
 , pythonOlder
-, testVersion
+, testers
 }:
 
 let self = buildPythonApplication rec {
@@ -31,7 +31,7 @@ let self = buildPythonApplication rec {
 
   propagatedBuildInputs = [ click glob2 parso pony junit-xml ];
 
-  passthru.tests.version = testVersion { package = self; };
+  passthru.tests.version = testers.testVersion { package = self; };
 
   meta = with lib; {
     description = "mutation testing system for Python, with a strong focus on ease of use";
diff --git a/pkgs/development/python-modules/staticjinja/default.nix b/pkgs/development/python-modules/staticjinja/default.nix
index ac3c173c09a..0c1a698aa63 100644
--- a/pkgs/development/python-modules/staticjinja/default.nix
+++ b/pkgs/development/python-modules/staticjinja/default.nix
@@ -9,7 +9,7 @@
 , pytest-check
 , pythonOlder
 , markdown
-, testVersion
+, testers
 , tomlkit
 , staticjinja
 , callPackage
@@ -53,7 +53,7 @@ buildPythonPackage rec {
   '';
 
   passthru.tests = {
-    version = testVersion { package = staticjinja; };
+    version = testers.testVersion { package = staticjinja; };
     minimal-template = callPackage ./test-minimal-template {};
   };
 
diff --git a/pkgs/development/quickemu/default.nix b/pkgs/development/quickemu/default.nix
index 7aa5b1602c3..0a0dfb004f1 100644
--- a/pkgs/development/quickemu/default.nix
+++ b/pkgs/development/quickemu/default.nix
@@ -19,7 +19,7 @@
 , zsync
 , OVMF
 , quickemu
-, testVersion
+, testers
 }:
 let
   runtimePaths = [
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  passthru.tests = testVersion { package = quickemu; };
+  passthru.tests = testers.testVersion { package = quickemu; };
 
   meta = with lib; {
     description = "Quickly create and run optimised Windows, macOS and Linux desktop virtual machines";
diff --git a/pkgs/development/tools/amazon-qldb-shell/default.nix b/pkgs/development/tools/amazon-qldb-shell/default.nix
index 6f6ef1ca8af..d017c213415 100644
--- a/pkgs/development/tools/amazon-qldb-shell/default.nix
+++ b/pkgs/development/tools/amazon-qldb-shell/default.nix
@@ -4,7 +4,7 @@
 , fetchFromGitHub
 , llvmPackages
 , rustPlatform
-, testVersion
+, testers
 }:
 
 let
@@ -27,7 +27,7 @@ let
 
     LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
 
-    passthru.tests.version = testVersion { inherit package; };
+    passthru.tests.version = testers.testVersion { inherit package; };
 
     meta = with lib; {
       description = "An interface to send PartiQL statements to Amazon Quantum Ledger Database (QLDB)";
diff --git a/pkgs/development/tools/bingo/default.nix b/pkgs/development/tools/bingo/default.nix
index 8fe1dbaa4be..6e7ed39a221 100644
--- a/pkgs/development/tools/bingo/default.nix
+++ b/pkgs/development/tools/bingo/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, bingo }:
+{ lib, buildGoModule, fetchFromGitHub, testers, bingo }:
 
 buildGoModule rec {
   pname = "bingo";
@@ -26,7 +26,7 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = bingo;
     command = "bingo version";
     version = "v${version}";
diff --git a/pkgs/development/tools/buf/default.nix b/pkgs/development/tools/buf/default.nix
index 128dd483499..746233fb0de 100644
--- a/pkgs/development/tools/buf/default.nix
+++ b/pkgs/development/tools/buf/default.nix
@@ -3,7 +3,7 @@
 , fetchFromGitHub
 , protobuf
 , git
-, testVersion
+, testers
 , buf
 , installShellFiles
 }:
@@ -70,7 +70,7 @@ buildGoModule rec {
     runHook postInstall
   '';
 
-  passthru.tests.version = testVersion { package = buf; };
+  passthru.tests.version = testers.testVersion { package = buf; };
 
   meta = with lib; {
     homepage = "https://buf.build";
diff --git a/pkgs/development/tools/fq/default.nix b/pkgs/development/tools/fq/default.nix
index ad8c43195c9..add4e21be89 100644
--- a/pkgs/development/tools/fq/default.nix
+++ b/pkgs/development/tools/fq/default.nix
@@ -2,7 +2,7 @@
 , buildGoModule
 , fetchFromGitHub
 , fq
-, testVersion
+, testers
 }:
 
 buildGoModule rec {
@@ -26,7 +26,7 @@ buildGoModule rec {
 
   subPackages = [ "." ];
 
-  passthru.tests = testVersion { package = fq; };
+  passthru.tests = testers.testVersion { package = fq; };
 
   meta = with lib; {
     description = "jq for binary formats";
diff --git a/pkgs/development/tools/gojq/default.nix b/pkgs/development/tools/gojq/default.nix
index d78c587cfbd..08fe68e3a0a 100644
--- a/pkgs/development/tools/gojq/default.nix
+++ b/pkgs/development/tools/gojq/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, gojq }:
+{ lib, buildGoModule, fetchFromGitHub, testers, gojq }:
 
 buildGoModule rec {
   pname = "gojq";
@@ -15,7 +15,7 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = gojq;
   };
 
diff --git a/pkgs/development/tools/kube-linter/default.nix b/pkgs/development/tools/kube-linter/default.nix
index d234e458c18..e982cbfed17 100644
--- a/pkgs/development/tools/kube-linter/default.nix
+++ b/pkgs/development/tools/kube-linter/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testVersion, kube-linter }:
+{ lib, buildGoModule, fetchFromGitHub, testers, kube-linter }:
 
 buildGoModule rec {
   pname = "kube-linter";
@@ -17,7 +17,7 @@ buildGoModule rec {
     "-s" "-w" "-X golang.stackrox.io/kube-linter/internal/version.version=${version}"
   ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = kube-linter;
     command = "kube-linter version";
   };
diff --git a/pkgs/development/tools/quick-lint-js/default.nix b/pkgs/development/tools/quick-lint-js/default.nix
index 47151dd1e66..43a7fa494ba 100644
--- a/pkgs/development/tools/quick-lint-js/default.nix
+++ b/pkgs/development/tools/quick-lint-js/default.nix
@@ -1,4 +1,4 @@
-{ cmake, fetchFromGitHub, lib, ninja, stdenv, testVersion, quick-lint-js }:
+{ cmake, fetchFromGitHub, lib, ninja, stdenv, testers, quick-lint-js }:
 
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   passthru.tests = {
-    version = testVersion { package = quick-lint-js; };
+    version = testers.testVersion { package = quick-lint-js; };
   };
 
   meta = with lib; {
diff --git a/pkgs/development/tools/selenium/chromedriver/default.nix b/pkgs/development/tools/selenium/chromedriver/default.nix
index a75488a229d..66a73b1c1e9 100644
--- a/pkgs/development/tools/selenium/chromedriver/default.nix
+++ b/pkgs/development/tools/selenium/chromedriver/default.nix
@@ -2,7 +2,7 @@
 , cairo, fontconfig, freetype, gdk-pixbuf, glib
 , glibc, gtk2, libX11, nspr, nss, pango
 , libxcb, libXi, libXrender, libXext, dbus
-, testVersion, chromedriver
+, testers, chromedriver
 }:
 
 let
@@ -56,7 +56,7 @@ in stdenv.mkDerivation rec {
     wrapProgram "$out/bin/chromedriver" --prefix LD_LIBRARY_PATH : "${libs}"
   '';
 
-  passthru.tests.version = testVersion { package = chromedriver; };
+  passthru.tests.version = testers.testVersion { package = chromedriver; };
 
   meta = with lib; {
     homepage = "https://chromedriver.chromium.org/";
diff --git a/pkgs/development/tools/sq/default.nix b/pkgs/development/tools/sq/default.nix
index 4141fd59733..0be6e6c7bb6 100644
--- a/pkgs/development/tools/sq/default.nix
+++ b/pkgs/development/tools/sq/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testVersion, sq }:
+{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, sq }:
 buildGoModule rec {
   pname = "sq";
   version = "0.15.4";
@@ -29,7 +29,7 @@ buildGoModule rec {
   '';
 
   passthru.tests = {
-    version = testVersion { package = sq; };
+    version = testers.testVersion { package = sq; };
   };
 
   meta = with lib; {
diff --git a/pkgs/development/tools/yarn/default.nix b/pkgs/development/tools/yarn/default.nix
index 0e39a714ccd..d934eadcdf8 100644
--- a/pkgs/development/tools/yarn/default.nix
+++ b/pkgs/development/tools/yarn/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, nodejs, fetchzip, testVersion, yarn }:
+{ lib, stdenv, nodejs, fetchzip, testers, yarn }:
 
 stdenv.mkDerivation rec {
   pname = "yarn";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     ln -s $out/libexec/yarn/bin/yarn.js $out/bin/yarnpkg
   '';
 
-  passthru.tests = testVersion { package = yarn; };
+  passthru.tests = testers.testVersion { package = yarn; };
 
   meta = with lib; {
     homepage = "https://yarnpkg.com/";
diff --git a/pkgs/games/lgogdownloader/default.nix b/pkgs/games/lgogdownloader/default.nix
index 0c40d537fce..ab029e055aa 100644
--- a/pkgs/games/lgogdownloader/default.nix
+++ b/pkgs/games/lgogdownloader/default.nix
@@ -11,7 +11,7 @@
 , rhash
 , tinyxml-2
 , help2man
-, testVersion
+, testers
 , lgogdownloader
 }:
 
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   ];
 
   passthru.tests = {
-    version = testVersion { package = lgogdownloader; };
+    version = testers.testVersion { package = lgogdownloader; };
   };
 
   meta = with lib; {
diff --git a/pkgs/games/opensupaplex/default.nix b/pkgs/games/opensupaplex/default.nix
index d3f8155f546..dc5d9aae690 100644
--- a/pkgs/games/opensupaplex/default.nix
+++ b/pkgs/games/opensupaplex/default.nix
@@ -4,7 +4,7 @@
 , fetchurl
 , makeDesktopItem
 , copyDesktopItems
-, testVersion
+, testers
 , opensupaplex
 , SDL2
 , SDL2_mixer
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = opensupaplex;
     command = "opensupaplex --help";
     version = "v${version}";
diff --git a/pkgs/games/warzone2100/default.nix b/pkgs/games/warzone2100/default.nix
index a44f965b0e5..2df306d686f 100644
--- a/pkgs/games/warzone2100/default.nix
+++ b/pkgs/games/warzone2100/default.nix
@@ -26,7 +26,7 @@
 , vulkan-loader
 , shaderc
 
-, testVersion
+, testers
 , warzone2100
 
 , withVideos ? false
@@ -104,7 +104,7 @@ stdenv.mkDerivation rec {
   '';
 
   passthru.tests = {
-    version = testVersion {
+    version = testers.testVersion {
       package = warzone2100;
       # The command always exits with code 1
       command = "(warzone2100 --version || [ $? -eq 1 ])";
diff --git a/pkgs/servers/monitoring/prometheus/promscale/default.nix b/pkgs/servers/monitoring/prometheus/promscale/default.nix
index dd297d4c258..fbd1661c5f8 100644
--- a/pkgs/servers/monitoring/prometheus/promscale/default.nix
+++ b/pkgs/servers/monitoring/prometheus/promscale/default.nix
@@ -2,7 +2,7 @@
 , buildGoModule
 , fetchFromGitHub
 , promscale
-, testVersion
+, testers
 }:
 
 buildGoModule rec {
@@ -40,7 +40,7 @@ buildGoModule rec {
     runHook postCheck
   '';
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = promscale;
     command = "promscale -version";
   };
diff --git a/pkgs/servers/stayrtr/default.nix b/pkgs/servers/stayrtr/default.nix
index cee68bd2f61..a168cf5b1ee 100644
--- a/pkgs/servers/stayrtr/default.nix
+++ b/pkgs/servers/stayrtr/default.nix
@@ -2,7 +2,7 @@
 , fetchFromGitHub
 , buildGoModule
 , stayrtr
-, testVersion
+, testers
 }:
 
 buildGoModule rec {
@@ -23,7 +23,7 @@ buildGoModule rec {
     "-X main.version=${version}"
   ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = stayrtr;
   };
 
diff --git a/pkgs/tools/admin/colmena/default.nix b/pkgs/tools/admin/colmena/default.nix
index d17366b38a8..8d7982060de 100644
--- a/pkgs/tools/admin/colmena/default.nix
+++ b/pkgs/tools/admin/colmena/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, rustPlatform, fetchFromGitHub, installShellFiles, colmena, testVersion }:
+{ stdenv, lib, rustPlatform, fetchFromGitHub, installShellFiles, colmena, testers }:
 
 rustPlatform.buildRustPackage rec {
   pname = "colmena";
@@ -29,7 +29,7 @@ rustPlatform.buildRustPackage rec {
     # We guarantee CLI and Nix API stability for the same minor version
     apiVersion = builtins.concatStringsSep "." (lib.take 2 (lib.splitString "." version));
 
-    tests.version = testVersion { package = colmena; };
+    tests.version = testers.testVersion { package = colmena; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/archivers/7zz/default.nix b/pkgs/tools/archivers/7zz/default.nix
index 03c95378a0a..b734232ca05 100644
--- a/pkgs/tools/archivers/7zz/default.nix
+++ b/pkgs/tools/archivers/7zz/default.nix
@@ -12,7 +12,7 @@
 
   # For tests
 , _7zz
-, testVersion
+, testers
 }:
 
 let
@@ -79,7 +79,7 @@ stdenv.mkDerivation rec {
 
   passthru = {
     updateScript = ./update.sh;
-    tests.version = testVersion {
+    tests.version = testers.testVersion {
       package = _7zz;
       command = "7zz --help";
     };
diff --git a/pkgs/tools/backup/discordchatexporter-cli/default.nix b/pkgs/tools/backup/discordchatexporter-cli/default.nix
index 8e98ea3c7c2..96de897c5f3 100644
--- a/pkgs/tools/backup/discordchatexporter-cli/default.nix
+++ b/pkgs/tools/backup/discordchatexporter-cli/default.nix
@@ -2,7 +2,7 @@
 , buildDotnetModule
 , fetchFromGitHub
 , dotnetCorePackages
-, testVersion
+, testers
 , discordchatexporter-cli
 }:
 
@@ -29,7 +29,7 @@ buildDotnetModule rec {
 
   passthru = {
     updateScript = ./updater.sh;
-    tests.version = testVersion {
+    tests.version = testers.testVersion {
       package = discordchatexporter-cli;
       version = "v${version}";
     };
diff --git a/pkgs/tools/compression/pxz/default.nix b/pkgs/tools/compression/pxz/default.nix
index 0f509a3bd17..f61e80cbc06 100644
--- a/pkgs/tools/compression/pxz/default.nix
+++ b/pkgs/tools/compression/pxz/default.nix
@@ -1,7 +1,7 @@
 { lib
 , stdenv
 , fetchFromGitHub
-, testVersion
+, testers
 , pxz
 , xz
 }:
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     "MANDIR=${placeholder "out"}/share/man"
   ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = pxz;
   };
 
diff --git a/pkgs/tools/filesystems/garage/default.nix b/pkgs/tools/filesystems/garage/default.nix
index 9d9f2535a04..8799ec5a3d2 100644
--- a/pkgs/tools/filesystems/garage/default.nix
+++ b/pkgs/tools/filesystems/garage/default.nix
@@ -1,4 +1,4 @@
-{ lib, rustPlatform, fetchFromGitea, protobuf, testVersion, garage }:
+{ lib, rustPlatform, fetchFromGitea, protobuf, testers, garage }:
 rustPlatform.buildRustPackage rec {
   pname = "garage";
   version = "0.7.0";
@@ -16,7 +16,7 @@ rustPlatform.buildRustPackage rec {
   nativeBuildInputs = [ protobuf ];
 
   passthru = {
-    tests.version = testVersion { package = garage; };
+    tests.version = testers.testVersion { package = garage; };
   };
 
   meta = {
diff --git a/pkgs/tools/misc/adrgen/default.nix b/pkgs/tools/misc/adrgen/default.nix
index 08fec93b587..83117f40350 100644
--- a/pkgs/tools/misc/adrgen/default.nix
+++ b/pkgs/tools/misc/adrgen/default.nix
@@ -1,7 +1,7 @@
 { lib
 , buildGoModule
 , fetchFromGitHub
-, testVersion
+, testers
 , adrgen
 }:
 
@@ -18,7 +18,7 @@ buildGoModule rec {
 
   vendorSha256 = "sha256-aDtUD+KKKSE0TpSi4+6HXSBMqF/TROZZhT0ox3a8Idk=";
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = adrgen;
     command = "adrgen version";
     version = "v${version}";
diff --git a/pkgs/tools/misc/arch-install-scripts/default.nix b/pkgs/tools/misc/arch-install-scripts/default.nix
index a967e4989e6..c89e575e8eb 100644
--- a/pkgs/tools/misc/arch-install-scripts/default.nix
+++ b/pkgs/tools/misc/arch-install-scripts/default.nix
@@ -6,7 +6,6 @@
 , coreutils
 , gawk
 , gnum4
-, testVersion
 , util-linux
 }:
 
diff --git a/pkgs/tools/misc/czkawka/default.nix b/pkgs/tools/misc/czkawka/default.nix
index fbe3a68d584..6385eade7aa 100644
--- a/pkgs/tools/misc/czkawka/default.nix
+++ b/pkgs/tools/misc/czkawka/default.nix
@@ -8,7 +8,7 @@
 , gdk-pixbuf
 , atk
 , gtk3
-, testVersion
+, testers
 , czkawka
 }:
 
@@ -38,7 +38,7 @@ rustPlatform.buildRustPackage rec {
     gtk3
   ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = czkawka;
     command = "czkawka_cli --version";
   };
diff --git a/pkgs/tools/misc/datefmt/default.nix b/pkgs/tools/misc/datefmt/default.nix
index 01927fedc28..c70d04326fc 100644
--- a/pkgs/tools/misc/datefmt/default.nix
+++ b/pkgs/tools/misc/datefmt/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, datefmt, testVersion }:
+{ lib, stdenv, fetchurl, datefmt, testers }:
 
 stdenv.mkDerivation rec {
   pname = "datefmt";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  passthru.tests.version = testVersion { package = datefmt; };
+  passthru.tests.version = testers.testVersion { package = datefmt; };
 
   meta = with lib; {
     homepage = "https://jb55.com/datefmt";
diff --git a/pkgs/tools/misc/dsq/default.nix b/pkgs/tools/misc/dsq/default.nix
index 8df3c2183ec..e0ecf5be6c6 100644
--- a/pkgs/tools/misc/dsq/default.nix
+++ b/pkgs/tools/misc/dsq/default.nix
@@ -5,7 +5,7 @@
 , runCommand
 , nix-update-script
 , dsq
-, testVersion
+, testers
 , diffutils
 }:
 
@@ -30,7 +30,7 @@ buildGoModule rec {
     updateScript = nix-update-script { attrPath = pname; };
 
     tests = {
-      version = testVersion { package = dsq; };
+      version = testers.testVersion { package = dsq; };
 
       pretty-csv = runCommand "${pname}-test" { } ''
         mkdir "$out"
diff --git a/pkgs/tools/misc/gummy/default.nix b/pkgs/tools/misc/gummy/default.nix
index cc1b68b7c0e..defe5950a11 100644
--- a/pkgs/tools/misc/gummy/default.nix
+++ b/pkgs/tools/misc/gummy/default.nix
@@ -1,7 +1,7 @@
 { lib
 , stdenv
 , fetchFromGitHub
-, testVersion
+, testers
 , gummy
 , cmake
 , libX11
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
     ln -s $out/libexec/gummyd $out/bin/gummyd
   '';
 
-  passthru.tests.version = testVersion { package = gummy; };
+  passthru.tests.version = testers.testVersion { package = gummy; };
 
   meta = with lib; {
     homepage = "https://github.com/Fushko/gummy";
diff --git a/pkgs/tools/misc/lsd/default.nix b/pkgs/tools/misc/lsd/default.nix
index d72fad1a666..157cc1adf8d 100644
--- a/pkgs/tools/misc/lsd/default.nix
+++ b/pkgs/tools/misc/lsd/default.nix
@@ -2,7 +2,7 @@
 , fetchFromGitHub
 , rustPlatform
 , installShellFiles
-, testVersion
+, testers
 , lsd
 }:
 
@@ -27,7 +27,7 @@ rustPlatform.buildRustPackage rec {
   # Found argument '--test-threads' which wasn't expected, or isn't valid in this context
   doCheck = false;
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = lsd;
   };
 
diff --git a/pkgs/tools/misc/zellij/default.nix b/pkgs/tools/misc/zellij/default.nix
index e8b39bb1caa..b12d096435b 100644
--- a/pkgs/tools/misc/zellij/default.nix
+++ b/pkgs/tools/misc/zellij/default.nix
@@ -10,7 +10,7 @@
 , Foundation
 , mandown
 , zellij
-, testVersion
+, testers
 }:
 
 rustPlatform.buildRustPackage rec {
@@ -54,7 +54,7 @@ rustPlatform.buildRustPackage rec {
       --zsh <($out/bin/zellij setup --generate-completion zsh)
   '';
 
-  passthru.tests.version = testVersion { package = zellij; };
+  passthru.tests.version = testers.testVersion { package = zellij; };
 
   meta = with lib; {
     description = "A terminal workspace with batteries included";
diff --git a/pkgs/tools/networking/clash/default.nix b/pkgs/tools/networking/clash/default.nix
index 844335df223..c73e487904e 100644
--- a/pkgs/tools/networking/clash/default.nix
+++ b/pkgs/tools/networking/clash/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, buildGoModule, testVersion, clash }:
+{ lib, fetchFromGitHub, buildGoModule, testers, clash }:
 
 buildGoModule rec {
   pname = "clash";
@@ -26,7 +26,7 @@ buildGoModule rec {
     "-X github.com/Dreamacro/clash/constant.Version=${version}"
   ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = clash;
     command = "clash -v";
   };
diff --git a/pkgs/tools/networking/curlie/default.nix b/pkgs/tools/networking/curlie/default.nix
index fb46ab3fe10..c251e1c149e 100644
--- a/pkgs/tools/networking/curlie/default.nix
+++ b/pkgs/tools/networking/curlie/default.nix
@@ -1,4 +1,4 @@
-{ buildGoModule, fetchFromGitHub, lib, curlie, testVersion }:
+{ buildGoModule, fetchFromGitHub, lib, curlie, testers }:
 
 buildGoModule rec {
   pname = "curlie";
@@ -15,7 +15,7 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" "-X main.version=${version}" ];
 
-  passthru.tests.version = testVersion {
+  passthru.tests.version = testers.testVersion {
     package = curlie;
     command = "curlie version";
   };
diff --git a/pkgs/tools/networking/innernet/default.nix b/pkgs/tools/networking/innernet/default.nix
index 68ccdfc3870..6f7669ff6f7 100644
--- a/pkgs/tools/networking/innernet/default.nix
+++ b/pkgs/tools/networking/innernet/default.nix
@@ -8,7 +8,7 @@
 , Security
 , libiconv
 , innernet
-, testVersion
+, testers
 }:
 
 rustPlatform.buildRustPackage rec {
@@ -40,8 +40,8 @@ rustPlatform.buildRustPackage rec {
   '';
 
   passthru.tests = {
-    serverVersion = testVersion { package = innernet; command = "innernet-server --version"; };
-    version = testVersion { package = innernet; command = "innernet --version"; };
+    serverVersion = testers.testVersion { package = innernet; command = "innernet-server --version"; };
+    version = testers.testVersion { package = innernet; command = "innernet --version"; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/networking/pmacct/default.nix b/pkgs/tools/networking/pmacct/default.nix
index 32b800521e1..aa699d5bcad 100644
--- a/pkgs/tools/networking/pmacct/default.nix
+++ b/pkgs/tools/networking/pmacct/default.nix
@@ -13,7 +13,7 @@
 , withPgSQL ? true, postgresql
 , withMysql ? true, libmysqlclient, zlib, numactl
 , gnutlsSupport ? false, gnutls
-, testVersion
+, testers
 , pmacct
 }:
 
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
   ++ lib.optional gnutlsSupport "--enable-gnutls";
 
   passthru.tests = {
-    version = testVersion { package = pmacct; command = "pmacct -V"; };
+    version = testers.testVersion { package = pmacct; command = "pmacct -V"; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/networking/smartdns/default.nix b/pkgs/tools/networking/smartdns/default.nix
index 399aeefd9c3..9763d52d0b1 100644
--- a/pkgs/tools/networking/smartdns/default.nix
+++ b/pkgs/tools/networking/smartdns/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, openssl, testVersion, smartdns }:
+{ lib, stdenv, fetchFromGitHub, openssl, testers, smartdns }:
 
 stdenv.mkDerivation rec {
   pname = "smartdns";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   installFlags = [ "SYSCONFDIR=${placeholder "out"}/etc" ];
 
   passthru.tests = {
-    version = testVersion { package = smartdns; };
+    version = testers.testVersion { package = smartdns; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/nix/alejandra/default.nix b/pkgs/tools/nix/alejandra/default.nix
index 43b6200972d..62deef516d5 100644
--- a/pkgs/tools/nix/alejandra/default.nix
+++ b/pkgs/tools/nix/alejandra/default.nix
@@ -1,7 +1,7 @@
 { lib
 , rustPlatform
 , fetchFromGitHub
-, testVersion
+, testers
 , alejandra
 }:
 
@@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {
   cargoSha256 = "sha256-SsIpggbRQPjpCYgCG4sSJ022MmMV4bJJ8UAHcJR74O8=";
 
   passthru.tests = {
-    version = testVersion { package = alejandra; };
+    version = testers.testVersion { package = alejandra; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/system/s-tui/default.nix b/pkgs/tools/system/s-tui/default.nix
index 1152e66bd88..5c759eea8a1 100644
--- a/pkgs/tools/system/s-tui/default.nix
+++ b/pkgs/tools/system/s-tui/default.nix
@@ -3,7 +3,7 @@
 , python3Packages
 , nix-update-script
 , s-tui
-, testVersion
+, testers
 }:
 
 python3Packages.buildPythonPackage rec {
@@ -22,7 +22,7 @@ python3Packages.buildPythonPackage rec {
 
   passthru = {
     updateScript = nix-update-script { attrPath = pname; };
-    tests = testVersion { package = s-tui; };
+    tests = testers.testVersion { package = s-tui; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/text/crowdin-cli/default.nix b/pkgs/tools/text/crowdin-cli/default.nix
index e73b58d4e6b..6111a6f1c8b 100644
--- a/pkgs/tools/text/crowdin-cli/default.nix
+++ b/pkgs/tools/text/crowdin-cli/default.nix
@@ -8,7 +8,7 @@
 , jre
 , makeWrapper
 , crowdin-cli
-, testVersion
+, testers
 , unzip
 }:
 
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  passthru.tests.version = testVersion { package = crowdin-cli; };
+  passthru.tests.version = testers.testVersion { package = crowdin-cli; };
 
   meta = with lib; {
     mainProgram = "crowdin";
diff --git a/pkgs/tools/text/difftastic/default.nix b/pkgs/tools/text/difftastic/default.nix
index 3109687fd18..1c1d6fc6bfa 100644
--- a/pkgs/tools/text/difftastic/default.nix
+++ b/pkgs/tools/text/difftastic/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, rustPlatform, tree-sitter, difftastic, testVersion }:
+{ lib, fetchFromGitHub, rustPlatform, tree-sitter, difftastic, testers }:
 
 rustPlatform.buildRustPackage rec {
   pname = "difftastic";
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-qHG3ve8HoMWBS/x6mRbXMsrpcqNqfVcbAkfYOk7Su/0=";
 
-  passthru.tests.version = testVersion { package = difftastic; };
+  passthru.tests.version = testers.testVersion { package = difftastic; };
 
   meta = with lib; {
     description = "A syntax-aware diff";
diff --git a/pkgs/tools/text/igrep/default.nix b/pkgs/tools/text/igrep/default.nix
index 28c896a828e..87f9de373e2 100644
--- a/pkgs/tools/text/igrep/default.nix
+++ b/pkgs/tools/text/igrep/default.nix
@@ -3,7 +3,7 @@
 , fetchFromGitHub
 , stdenv
 , Security
-, testVersion
+, testers
 , igrep
 }:
 
@@ -23,7 +23,7 @@ rustPlatform.buildRustPackage rec {
   buildInputs = lib.optionals stdenv.isDarwin [ Security ];
 
   passthru.tests = {
-    version = testVersion { package = igrep; command = "ig --version"; };
+    version = testers.testVersion { package = igrep; command = "ig --version"; };
   };
 
   meta = with lib; {
diff --git a/pkgs/tools/text/mdbook-linkcheck/default.nix b/pkgs/tools/text/mdbook-linkcheck/default.nix
index b37b16876b0..eaccd05eb9c 100644
--- a/pkgs/tools/text/mdbook-linkcheck/default.nix
+++ b/pkgs/tools/text/mdbook-linkcheck/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, openssl, Security
-, testVersion, mdbook-linkcheck }:
+, testers, mdbook-linkcheck }:
 
 rustPlatform.buildRustPackage rec {
   pname = "mdbook-linkcheck";
@@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec {
 
   doCheck = false; # tries to access network to test broken web link functionality
 
-  passthru.tests.version = testVersion { package = mdbook-linkcheck; };
+  passthru.tests.version = testers.testVersion { package = mdbook-linkcheck; };
 
   meta = with lib; {
     description = "A backend for `mdbook` which will check your links for you.";
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 9279a9f6406..6a42ebc5b5b 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -1255,6 +1255,7 @@ mapAliases ({
   terraform_1_0 = throw "terraform_1_0 has been renamed to terraform_1"; # Added 2021-12-08
   terraform_1_0_0 = throw "terraform_1_0_0 has been renamed to terraform_1"; # Added 2021-06-15
   tesseract_4 = throw "'tesseract_4' has been renamed to/replaced by 'tesseract4'"; # Converted to throw 2022-02-22
+  testVersion = testers.testVersion; # Added 2022-04-20
   tex-gyre-bonum-math = throw "'tex-gyre-bonum-math' has been renamed to/replaced by 'tex-gyre-math.bonum'"; # Converted to throw 2022-02-22
   tex-gyre-pagella-math = throw "'tex-gyre-pagella-math' has been renamed to/replaced by 'tex-gyre-math.pagella'"; # Converted to throw 2022-02-22
   tex-gyre-schola-math = throw "'tex-gyre-schola-math' has been renamed to/replaced by 'tex-gyre-math.schola'"; # Converted to throw 2022-02-22
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 67fcb64d459..16ee7ddc6fe 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -725,8 +725,8 @@ with pkgs;
 
   installShellFiles = callPackage ../build-support/install-shell-files {};
 
-  # See doc/builders/special/invalidateFetcherByDrvHash.section.md or
-  # https://nixos.org/manual/nixpkgs/unstable/#sec-pkgs-invalidateFetcherByDrvHash
+  # See doc/builders/testers.chapter.md or
+  # https://nixos.org/manual/nixpkgs/unstable/#tester-invalidateFetcherByDrvHash
   invalidateFetcherByDrvHash = f: args:
     let
       drvPath = (f args).drvPath;