depot/third_party/nixpkgs/pkgs/test/coq/overrideCoqDerivation/default.nix
Default email 7bc014aa9c Project import generated by Copybara.
GitOrigin-RevId: c97e777ff06fcb8d37dcdf5e21e9eff1f34f0e90
2022-09-11 12:47:08 -03:00

40 lines
1.4 KiB
Nix

{ lib, coq, mkCoqPackages, runCommand }:
let
# This is just coq, but with dontFilter set to true. We need to set
# dontFilter to true here so that _all_ packages are visibile in coqPackages.
# There may be some versions of the top-level coq and coqPackages that don't
# build QuickChick, which is what we are using for this test below.
coqWithAllPackages = coq // { dontFilter = true; };
coqPackages = mkCoqPackages coqWithAllPackages;
# This is the main test. This uses overrideCoqDerivation to
# override arguments to mkCoqDerivation.
#
# Here, we override the defaultVersion and release arguments to
# mkCoqDerivation.
overriddenQuickChick =
coqPackages.lib.overrideCoqDerivation
{
defaultVersion = "9999";
release."9999".sha256 = lib.fakeSha256;
}
coqPackages.QuickChick;
in
runCommand
"coq-overrideCoqDerivation-test-0.1"
{ meta.maintainers = with lib.maintainers; [cdepillabout]; }
''
# Confirm that the computed version number for the overridden QuickChick does
# actually become 9999, as set above.
if [ "${overriddenQuickChick.version}" -eq "9999" ]; then
echo "overriddenQuickChick version was successfully set to 9999"
touch $out
else
echo "ERROR: overriddenQuickChick version was supposed to be 9999, but was actually: ${overriddenQuickChick.version}"
exit 1
fi
''