about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/logic/elan/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/logic/elan/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/logic/elan/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/logic/elan/default.nix b/nixpkgs/pkgs/applications/science/logic/elan/default.nix
new file mode 100644
index 000000000000..f0b912c57fc5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/logic/elan/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, pkgconfig, curl, openssl, zlib, fetchFromGitHub, rustPlatform }:
+
+rustPlatform.buildRustPackage rec {
+  name = "elan-${version}";
+  version = "0.7.1";
+
+  cargoSha256 = "0vv7kr7rc3lvas7ngp5dp99ajjd5v8k5937ish7zqz1k4970q2f1";
+
+  src = fetchFromGitHub {
+    owner = "kha";
+    repo = "elan";
+    rev = "v${version}";
+    sha256 = "0x5s1wm78yx5ci63wrmlkzm6k3281p33gn4dzw25k5s4vx0p9n24";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ curl zlib openssl ];
+
+  cargoBuildFlags = [ "--features no-self-update" ];
+
+  postInstall = ''
+    pushd $out/bin
+    mv elan-init elan
+    for link in lean leanpkg leanchecker; 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 stdenv.lib; {
+    description = "Small tool to manage your installations of the Lean theorem prover";
+    homepage = "https://github.com/Kha/elan";
+    license = with licenses; [ asl20 /* or */ mit ];
+    maintainers = with maintainers; [ gebner ];
+  };
+}