diff --git a/pkgs/applications/science/logic/lean4/default.nix b/pkgs/applications/science/logic/lean4/default.nix new file mode 100644 index 000000000000..7509ca63c804 --- /dev/null +++ b/pkgs/applications/science/logic/lean4/default.nix @@ -0,0 +1,60 @@ +{ lib +, stdenv +, cmake +, fetchFromGitHub +, git +, gmp +, perl +}: + +stdenv.mkDerivation rec { + pname = "lean4"; + version = "4.0.0"; + + src = fetchFromGitHub { + owner = "leanprover"; + repo = "lean4"; + rev = "v${version}"; + hash = "sha256-3Ni+NiD0iSsOruUyRpBd+aC0TZNYfOLhwqCpPHPruPg="; + }; + + postPatch = '' + substituteInPlace src/CMakeLists.txt \ + --replace 'set(GIT_SHA1 "")' 'set(GIT_SHA1 "${src.rev}")' + + # Remove tests that fails in sandbox. + # It expects `sourceRoot` to be a git repository. + rm -rf src/lake/examples/git/ + ''; + + preConfigure = '' + patchShebangs stage0/src/bin/ src/bin/ + ''; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + gmp + ]; + + nativeCheckInputs = [ + git + perl + ]; + + cmakeFlags = [ + "-DUSE_GITHASH=OFF" + ]; + + meta = with lib; { + description = "Automatic and interactive theorem prover"; + homepage = "https://leanprover.github.io/"; + changelog = "https://github.com/leanprover/lean4/blob/${src.rev}/RELEASES.md"; + license = licenses.asl20; + platforms = platforms.all; + maintainers = with maintainers; [ marsam ]; + mainProgram = "lean"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a50e4abcfdaa..dc719731f271 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39772,6 +39772,7 @@ with pkgs; lean = callPackage ../applications/science/logic/lean { }; lean2 = callPackage ../applications/science/logic/lean2 { }; + lean4 = callPackage ../applications/science/logic/lean4 { }; lean3 = lean; elan = callPackage ../applications/science/logic/elan { }; mathlibtools = with python3Packages; toPythonApplication mathlibtools;