2017-01-03 15:50:56 +00:00
|
|
|
{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage }:
|
2016-11-25 08:46:40 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (stdenv.lib) optionalString;
|
|
|
|
|
2017-01-03 15:50:56 +00:00
|
|
|
platform = if stdenv.system == "x86_64-linux"
|
2016-11-25 08:46:40 +00:00
|
|
|
then "x86_64-unknown-linux-gnu"
|
|
|
|
else abort "missing boostrap url for platform ${stdenv.system}";
|
|
|
|
|
|
|
|
bootstrapHash =
|
|
|
|
if stdenv.system == "x86_64-linux"
|
2017-01-03 17:37:55 +00:00
|
|
|
then "05bppmc6hqgv2g4x76rj95xf40x2aikqmcnql5li27rqwliyxznj"
|
2016-11-25 08:46:40 +00:00
|
|
|
else throw "missing boostrap hash for platform ${stdenv.system}";
|
|
|
|
|
|
|
|
needsPatchelf = stdenv.isLinux;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2016-12-12 17:59:10 +00:00
|
|
|
url = "https://static.rust-lang.org/dist/${version}/rust-nightly-${platform}.tar.gz";
|
2016-11-25 08:46:40 +00:00
|
|
|
sha256 = bootstrapHash;
|
|
|
|
};
|
|
|
|
|
2017-01-03 15:50:56 +00:00
|
|
|
version = "2016-12-29";
|
2016-11-25 08:46:40 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
rec {
|
2017-01-03 15:50:56 +00:00
|
|
|
inherit buildRustPackage;
|
|
|
|
|
2016-11-25 08:46:40 +00:00
|
|
|
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 17:59:10 +00:00
|
|
|
--components=rustc,rust-std-x86_64-unknown-linux-gnu
|
2016-11-25 08:46:40 +00:00
|
|
|
|
|
|
|
${optionalString needsPatchelf ''
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
"$out/bin/rustc"
|
2017-01-08 09:53:44 +00:00
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
"$out/bin/rustdoc"
|
2016-11-25 08:46:40 +00:00
|
|
|
''}
|
|
|
|
'';
|
2017-01-03 15:50:56 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
cargo = stdenv.mkDerivation rec {
|
|
|
|
name = "cargo-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 \
|
|
|
|
--components=cargo
|
|
|
|
|
|
|
|
${optionalString needsPatchelf ''
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
"$out/bin/cargo"
|
|
|
|
''}
|
|
|
|
'';
|
2016-11-25 08:46:40 +00:00
|
|
|
};
|
|
|
|
}
|