diff --git a/doc/builders/fetchers.chapter.md b/doc/builders/fetchers.chapter.md index d9f22b062827..09a41cd9ce0b 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 2f84599cdd4f..8902ce5c8132 100644 --- a/doc/builders/special.xml +++ b/doc/builders/special.xml @@ -7,5 +7,4 @@ - diff --git a/doc/builders/special/invalidateFetcherByDrvHash.section.md b/doc/builders/special/invalidateFetcherByDrvHash.section.md deleted file mode 100644 index 7c2f03a64b7b..000000000000 --- 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 000000000000..2c30c8bd240e --- /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 testers 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 e49ae67ec943..ccbaf40586d1 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -25,6 +25,7 @@ Builders + diff --git a/pkgs/applications/audio/furnace/default.nix b/pkgs/applications/audio/furnace/default.nix index 841a65e541fc..115c5b7767d2 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 7b76d91acf81..f06907ad32f2 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 48008c369333..74a60857a6a3 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 116d5430c2a8..6afd9ee62420 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 ecb789282173..60482a84c9b4 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 e2e43ae09971..552a63240d51 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 2513476ad74e..ff74d8b098f3 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 f6ed2daf8ec7..24511096f1d4 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 70442e47e66b..eacc66271d5a 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 1bacd8510dc4..73a5d964f34b 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 be85981f7bf4..fb1888d62358 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 aade6c549f31..bab73c41f5f5 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 e89216802e50..18e09326f35f 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 cbabc6b10c72..bd6df5ef6bee 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 85a7ecb08c39..aee1a9c63f8f 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 573f69fef007..bed96493e513 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 3396718edbc2..65ca1b476d4d 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 daabe71bebb7..ed7239b80cb3 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 30ea7e1524a9..c99bb409c3e9 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 841604399ed3..3c73e7f59944 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 17272acd86eb..6feeb17256a9 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 1d1effa37306..8b79843b8332 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 652f3716b2a7..610d5f585576 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 1f9543f808e6..bd14971fe78b 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 25bedd397b2f..3c4d90ccb054 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 7356175c87c4..2c8d6eb21aeb 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 ae0f06213a87..626c768f2a81 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 ac3c173c09a5..0c1a698aa63c 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 7aa5b1602c38..0a0dfb004f13 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 6f6ef1ca8af7..d017c213415c 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 8fe1dbaa4bea..6e7ed39a221c 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 128dd4834995..746233fb0dee 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 ad8c43195c9d..add4e21be89d 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 d78c587cfbda..08fe68e3a0a1 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 d234e458c184..e982cbfed173 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 47151dd1e662..43a7fa494ba4 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 a75488a229df..66a73b1c1e98 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 4141fd59733c..0be6e6c7bb6e 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 0e39a714ccda..d934eadcdf8a 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 0c40d537fcec..ab029e055aa9 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 d3f8155f546c..dc5d9aae690c 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 a44f965b0e55..2df306d686f2 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 dd297d4c2585..fbd1661c5f8b 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 cee68bd2f61b..a168cf5b1eec 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 d17366b38a81..8d7982060de6 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 03c95378a0ae..b734232ca053 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 8e98ea3c7c28..96de897c5f34 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 0f509a3bd170..f61e80cbc065 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 9d9f2535a04f..8799ec5a3d2a 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 08fec93b5871..83117f403506 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 a967e4989e61..c89e575e8eb0 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 fbe3a68d5842..6385eade7aa4 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 01927fedc28d..c70d04326fc8 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 8df3c2183ec7..e0ecf5be6c60 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 cc1b68b7c0e8..defe5950a116 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 d72fad1a666c..157cc1adf8d7 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 e8b39bb1caa1..b12d096435bd 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 844335df223c..c73e487904ef 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 fb46ab3fe102..c251e1c149ee 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 68ccdfc3870d..6f7669ff6f7f 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 32b800521e16..aa699d5bcad5 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 399aeefd9c3d..9763d52d0b1d 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 43b6200972dd..62deef516d50 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 1152e66bd887..5c759eea8a12 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 e73b58d4e6ba..6111a6f1c8bd 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 3109687fd189..1c1d6fc6bfa0 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 28c896a828e5..87f9de373e23 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 b37b16876b0f..eaccd05eb9c4 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 9279a9f64068..6a42ebc5b5be 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 67fcb64d4593..16ee7ddc6fef 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;