2024-02-29 20:09:43 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, gmp, coreutils }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lean";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "3.51.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "leanprover-community";
|
|
|
|
repo = "lean";
|
2021-05-28 09:39:13 +00:00
|
|
|
# lean's version string contains the commit sha1 it was built
|
|
|
|
# from. this is then used to check whether an olean file should be
|
|
|
|
# rebuilt. don't use a tag as rev because this will get replaced into
|
|
|
|
# src/githash.h.in in preConfigure.
|
2023-05-24 13:37:59 +00:00
|
|
|
rev = "9fc1dee97a72a3e34d658aefb4b8a95ecd3d477c";
|
|
|
|
hash = "sha256-Vcsph4dTNLafeaTtVwJS8tWoWCgcP6pxF0ssZDE/YfM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
patches = [
|
|
|
|
# Fix gcc-13 build failure
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc-13.patch";
|
|
|
|
url = "https://github.com/leanprover-community/lean/commit/21d264a66d53b0a910178ae7d9529cb5886a39b6.patch";
|
|
|
|
hash = "sha256-hBm2QNFS1jdoR6LUQHLReKxMKv7kbkrkrTGJ43YnvfA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ gmp ];
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
cmakeDir = "../src";
|
|
|
|
|
|
|
|
# Running the tests is required to build the *.olean files for the core
|
|
|
|
# library.
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
preConfigure = assert builtins.stringLength src.rev == 40; ''
|
|
|
|
substituteInPlace src/githash.h.in \
|
|
|
|
--subst-var-by GIT_SHA1 "${src.rev}"
|
|
|
|
substituteInPlace library/init/version.lean.in \
|
|
|
|
--subst-var-by GIT_SHA1 "${src.rev}"
|
|
|
|
'';
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
postPatch = "patchShebangs .";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2020-05-29 06:06:01 +00:00
|
|
|
substituteInPlace $out/bin/leanpkg \
|
|
|
|
--replace "greadlink" "${coreutils}/bin/readlink"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Automatic and interactive theorem prover";
|
|
|
|
homepage = "https://leanprover.github.io/";
|
|
|
|
changelog = "https://github.com/leanprover-community/lean/blob/v${version}/doc/changes.md";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice gebner ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|