···1+{ lib, coq, mkCoqPackages, runCommandNoCC }:
2+3+let
4+5+ # This is just coq, but with dontFilter set to true. We need to set
6+ # dontFilter to true here so that _all_ packages are visibile in coqPackages.
7+ # There may be some versions of the top-level coq and coqPackages that don't
8+ # build QuickChick, which is what we are using for this test below.
9+ coqWithAllPackages = coq // { dontFilter = true; };
10+11+ coqPackages = mkCoqPackages coqWithAllPackages;
12+13+ # This is the main test. This uses overrideCoqDerivation to
14+ # override arguments to mkCoqDerivation.
15+ #
16+ # Here, we override the defaultVersion and release arguments to
17+ # mkCoqDerivation.
18+ overriddenQuickChick =
19+ coqPackages.lib.overrideCoqDerivation
20+ {
21+ defaultVersion = "9999";
22+ release."9999".sha256 = lib.fakeSha256;
23+ }
24+ coqPackages.QuickChick;
25+in
26+27+runCommandNoCC
28+ "coq-overrideCoqDerivation-test-0.1"
29+ { meta.maintainers = with lib.maintainers; [cdepillabout]; }
30+ ''
31+ # Confirm that the computed version number for the overridden QuickChick does
32+ # actually become 9999, as set above.
33+ if [ "${overriddenQuickChick.version}" -eq "9999" ]; then
34+ echo "overriddenQuickChick version was successfully set to 9999"
35+ touch $out
36+ else
37+ echo "ERROR: overriddenQuickChick version was supposed to be 9999, but was actually: ${overriddenQuickChick.version}"
38+ exit 1
39+ fi
40+ ''