mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
71 lines
2.4 KiB
Nix
71 lines
2.4 KiB
Nix
{ stdenv, lib, runCommand, patchelf, makeWrapper, pkg-config, curl, runtimeShell
|
|
, openssl, zlib, fetchFromGitHub, rustPlatform, libiconv }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "elan";
|
|
version = "3.1.1-unstable-2024-08-02";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "leanprover";
|
|
repo = "elan";
|
|
# commit "chore: update to build with rust 1.80 (leanprover/elan#134)"
|
|
rev = "97ce78e0e6aecdf3e8d35dbf42b0614302efb250";
|
|
hash = "sha256-7cwpHMyhpTxYXjZM4xbDK+epvA2kBf7jelvMaPGP1kU=";
|
|
};
|
|
|
|
cargoHash = "sha256-ON5d7ryMKEhkx6dV760msr+y/+4hIwssXUE5Ocaq2W0=";
|
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
|
|
|
OPENSSL_NO_VENDOR = 1;
|
|
buildInputs = [ curl zlib openssl ]
|
|
++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
|
|
|
|
buildFeatures = [ "no-self-update" ];
|
|
|
|
patches = lib.optionals stdenv.hostPlatform.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";
|
|
ar = "${stdenv.cc}/bin/ar";
|
|
patchelf = patchelf;
|
|
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 \
|
|
--subst-var ar \
|
|
--subst-var shell
|
|
'')
|
|
];
|
|
|
|
postInstall = ''
|
|
pushd $out/bin
|
|
mv elan-init elan
|
|
for link in lean leanpkg leanchecker leanc leanmake lake; do
|
|
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; {
|
|
description = "Small tool to manage your installations of the Lean theorem prover";
|
|
homepage = "https://github.com/leanprover/elan";
|
|
changelog = "https://github.com/leanprover/elan/blob/v${version}/CHANGELOG.md";
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
maintainers = with maintainers; [ gebner ];
|
|
mainProgram = "elan";
|
|
};
|
|
}
|