summary refs log tree commit diff
path: root/pkgs/development/tools/rust/racer/default.nix
blob: 341088dc0f2da217f8fcff8cd5d741cab4eadd12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{stdenv, fetchgit, rustc, cargo, makeWrapper }:

stdenv.mkDerivation rec {
  #TODO add emacs support
  name = "racer-git-2015-04-12";
  src = fetchgit {
    url = https://github.com/phildawes/racer;
    rev = "5437e2074d87dfaab75a0f1bd2597bed61c0bbf1";
    sha256 = "0a768gvjry86l0xa5q0122iyq7zn2h9adfniglsgrbs4fan49xyn";
  };

  buildInputs = [ rustc cargo makeWrapper ];

  buildPhase = ''
    CARGO_HOME="$NIX_BUILD_TOP/.cargo" cargo build --release
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp -p target/release/racer $out/bin/
    wrapProgram $out/bin/racer --set RUST_SRC_PATH "${rustc.src}/src"
    install -d $out/share/emacs/site-lisp
    install "editors/"*.el $out/share/emacs/site-lisp
  '';

  meta = with stdenv.lib; {
    description = "A utility intended to provide Rust code completion for editors and IDEs.";
    homepage = https://github.com/phildawes/racer;
    license = stdenv.lib.licenses.mit;
    maintainers = [ maintainers.jagajaga ];
  };
}