···11+{ lib, coq, mkCoqPackages, runCommandNoCC }:
22+33+let
44+55+ # This is just coq, but with dontFilter set to true. We need to set
66+ # dontFilter to true here so that _all_ packages are visibile in coqPackages.
77+ # There may be some versions of the top-level coq and coqPackages that don't
88+ # build QuickChick, which is what we are using for this test below.
99+ coqWithAllPackages = coq // { dontFilter = true; };
1010+1111+ coqPackages = mkCoqPackages coqWithAllPackages;
1212+1313+ # This is the main test. This uses overrideCoqDerivation to
1414+ # override arguments to mkCoqDerivation.
1515+ #
1616+ # Here, we override the defaultVersion and release arguments to
1717+ # mkCoqDerivation.
1818+ overriddenQuickChick =
1919+ coqPackages.lib.overrideCoqDerivation
2020+ {
2121+ defaultVersion = "9999";
2222+ release."9999".sha256 = lib.fakeSha256;
2323+ }
2424+ coqPackages.QuickChick;
2525+in
2626+2727+runCommandNoCC
2828+ "coq-overrideCoqDerivation-test-0.1"
2929+ { meta.maintainers = with lib.maintainers; [cdepillabout]; }
3030+ ''
3131+ # Confirm that the computed version number for the overridden QuickChick does
3232+ # actually become 9999, as set above.
3333+ if [ "${overriddenQuickChick.version}" -eq "9999" ]; then
3434+ echo "overriddenQuickChick version was successfully set to 9999"
3535+ touch $out
3636+ else
3737+ echo "ERROR: overriddenQuickChick version was supposed to be 9999, but was actually: ${overriddenQuickChick.version}"
3838+ exit 1
3939+ fi
4040+ ''