nixpkgs-suyu/pkgs/applications/science/logic/elan/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
2.1 KiB
Nix
Raw Normal View History

2021-11-08 17:29:22 +01:00
{ stdenv, lib, runCommand, patchelf, makeWrapper, pkg-config, curl, runtimeShell
, openssl, zlib, fetchFromGitHub, rustPlatform, libiconv }:
2018-04-10 18:36:12 +02:00
rustPlatform.buildRustPackage rec {
2019-08-31 13:41:23 +02:00
pname = "elan";
2022-09-13 11:00:29 +02:00
version = "1.4.2";
2018-04-10 18:36:12 +02:00
src = fetchFromGitHub {
2021-04-22 10:54:42 +02:00
owner = "leanprover";
2018-04-10 18:36:12 +02:00
repo = "elan";
rev = "v${version}";
2022-09-13 11:00:29 +02:00
sha256 = "1aq06d66y622n0bbd57dx8s0ajz6cdv1vzaz25wvi4i62sg4x21x";
2018-04-10 18:36:12 +02:00
};
2022-09-13 11:00:29 +02:00
cargoSha256 = "sha256-RzeewQzsV5F5E0xwJF1MpzzQ8usyfQjzlDInOJqZdO8=";
nativeBuildInputs = [ pkg-config makeWrapper ];
2018-04-10 18:36:12 +02:00
OPENSSL_NO_VENDOR = 1;
2021-05-15 12:02:46 +02:00
buildInputs = [ curl zlib openssl ]
++ lib.optional stdenv.isDarwin libiconv;
2018-04-10 18:36:12 +02:00
2021-11-16 01:08:39 +01:00
buildFeatures = [ "no-self-update" ];
2018-04-10 18:36:12 +02:00
patches = lib.optionals stdenv.isLinux [
# Run patchelf on the downloaded binaries.
# This is necessary because Lean 4 is now dynamically linked.
(runCommand "0001-dynamically-patchelf-binaries.patch" {
CC = stdenv.cc;
cc = "${stdenv.cc}/bin/cc";
2022-08-22 16:52:52 +02:00
ar = "${stdenv.cc}/bin/ar";
patchelf = patchelf;
2021-11-08 17:29:22 +01:00
shell = runtimeShell;
} ''
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
--subst-var patchelf \
--subst-var dynamicLinker \
--subst-var cc \
2022-08-22 16:52:52 +02:00
--subst-var ar \
2021-11-08 17:29:22 +01:00
--subst-var shell
'')
];
2018-04-10 18:36:12 +02:00
postInstall = ''
pushd $out/bin
mv elan-init elan
2021-10-09 20:06:10 +02:00
for link in lean leanpkg leanchecker leanc leanmake lake; do
2018-04-10 18:36:12 +02:00
ln -s elan $link
done
popd
# tries to create .elan
export HOME=$(mktemp -d)
mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
$out/bin/elan completions bash > "$out/share/bash-completion/completions/elan"
$out/bin/elan completions fish > "$out/share/fish/vendor_completions.d/elan.fish"
$out/bin/elan completions zsh > "$out/share/zsh/site-functions/_elan"
'';
meta = with lib; {
2018-04-10 18:36:12 +02:00
description = "Small tool to manage your installations of the Lean theorem prover";
2021-04-22 10:54:42 +02:00
homepage = "https://github.com/leanprover/elan";
2018-04-10 18:36:12 +02:00
license = with licenses; [ asl20 /* or */ mit ];
maintainers = with maintainers; [ gebner ];
};
}