@@ -0,0 +1,44 @@
1+{ stdenv, lib, pkgconfig, curl, openssl, zlib, fetchFromGitHub, rustPlatform }:
2+
3+rustPlatform.buildRustPackage rec {
4+ name = "elan-${version}";
5+ version = "0.1.0";
6+
7+ cargoSha256 = "04cxwklfgz4q28grva52ws3lslaiq67fwqf6pglbzdrfbgdjjwb6";
8+
9+ src = fetchFromGitHub {
10+ owner = "kha";
11+ repo = "elan";
12+ rev = "v${version}";
13+ sha256 = "065l9a1g974n8i44mz37sx88fl65h5hml611m4p81cy6av2x85sm";
14+ };
15+
16+ nativeBuildInputs = [ pkgconfig ];
17+
18+ buildInputs = [ curl zlib openssl ];
19+
20+ cargoBuildFlags = [ "--features no-self-update" ];
21+
22+ postInstall = ''
23+ pushd $out/bin
24+ mv elan-init elan
25+ for link in lean leanpkg; do
26+ ln -s elan $link
27+ done
28+ popd
29+
30+ # tries to create .elan
31+ export HOME=$(mktemp -d)
32+ mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
33+ $out/bin/elan completions bash > "$out/share/bash-completion/completions/elan"
34+ $out/bin/elan completions fish > "$out/share/fish/vendor_completions.d/elan.fish"
35+ $out/bin/elan completions zsh > "$out/share/zsh/site-functions/_elan"
36+ '';
37+
38+ meta = with stdenv.lib; {
39+ description = "Small tool to manage your installations of the Lean theorem prover";
40+ homepage = "https://github.com/Kha/elan";
41+ license = with licenses; [ asl20 /* or */ mit ];
42+ maintainers = with maintainers; [ gebner ];
43+ };
44+}