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

66 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";
version = "1.3.1";
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}";
sha256 = "sha256-QNVzpnT77+9PXhq4Yz0q3o+GiQTVy7dOrg2yBTscoek=";
2018-04-10 18:36:12 +02:00
};
cargoSha256 = "sha256-G70QopoMqFrkOnuui3+3cEHYvmnf0meX1Ecv4q8FCpM=";
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";
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 \
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 ];
};
}