2016-11-25 09:46:40 +01:00
|
|
|
{ stdenv, fetchurl, makeWrapper, cacert, zlib }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (stdenv.lib) optionalString;
|
|
|
|
|
|
|
|
platform = if stdenv.system == "x86_64-linux"
|
|
|
|
then "x86_64-unknown-linux-gnu"
|
|
|
|
else abort "missing boostrap url for platform ${stdenv.system}";
|
|
|
|
|
|
|
|
bootstrapHash =
|
|
|
|
if stdenv.system == "x86_64-linux"
|
2016-12-12 18:59:10 +01:00
|
|
|
then "1afsqaavhwiaxm38zr08cbq0985c7lrb1jzdcmq0jh6y8rb8ikff"
|
2016-11-25 09:46:40 +01:00
|
|
|
else throw "missing boostrap hash for platform ${stdenv.system}";
|
|
|
|
|
|
|
|
needsPatchelf = stdenv.isLinux;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2016-12-12 18:59:10 +01:00
|
|
|
url = "https://static.rust-lang.org/dist/${version}/rust-nightly-${platform}.tar.gz";
|
2016-11-25 09:46:40 +01:00
|
|
|
sha256 = bootstrapHash;
|
|
|
|
};
|
|
|
|
|
2016-12-12 18:59:10 +01:00
|
|
|
version = "2016-12-05";
|
2016-11-25 09:46:40 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
rec {
|
|
|
|
rustc = stdenv.mkDerivation rec {
|
|
|
|
name = "rustc-nightly-${version}";
|
|
|
|
|
|
|
|
inherit version;
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.rust-lang.org/;
|
|
|
|
description = "A safe, concurrent, practical language";
|
|
|
|
maintainers = with maintainers; [ qknight ];
|
|
|
|
license = [ licenses.mit licenses.asl20 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
phases = ["unpackPhase" "installPhase"];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
./install.sh --prefix=$out \
|
2016-12-12 18:59:10 +01:00
|
|
|
--components=rustc,rust-std-x86_64-unknown-linux-gnu
|
2016-11-25 09:46:40 +01:00
|
|
|
|
|
|
|
${optionalString needsPatchelf ''
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
"$out/bin/rustc"
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|