2017-03-17 13:51:28 +00:00
|
|
|
{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage, curl }:
|
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"
|
2017-03-09 01:37:14 +00:00
|
|
|
else throw "missing bootstrap url for platform ${stdenv.system}";
|
2016-11-25 08:46:40 +00:00
|
|
|
|
|
|
|
bootstrapHash =
|
|
|
|
if stdenv.system == "x86_64-linux"
|
2017-03-17 13:51:28 +00:00
|
|
|
then "1d5h34dkm1r1ff562szygn9xk2qll1pjryvypl0lazzanxdh5gv5"
|
2017-03-09 01:37:14 +00:00
|
|
|
else throw "missing bootstrap hash for platform ${stdenv.system}";
|
2016-11-25 08:46:40 +00:00
|
|
|
|
|
|
|
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-03-17 13:51:28 +00:00
|
|
|
version = "2017-03-16";
|
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 ];
|
|
|
|
};
|
|
|
|
|
2017-03-17 13:51:28 +00:00
|
|
|
buildInputs = [ makeWrapper curl ];
|
2017-01-03 15:50:56 +00:00
|
|
|
phases = ["unpackPhase" "installPhase"];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
./install.sh --prefix=$out \
|
|
|
|
--components=cargo
|
|
|
|
|
|
|
|
${optionalString needsPatchelf ''
|
|
|
|
patchelf \
|
2017-03-17 13:51:28 +00:00
|
|
|
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
|
2017-01-03 15:50:56 +00:00
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
"$out/bin/cargo"
|
|
|
|
''}
|
|
|
|
'';
|
2016-11-25 08:46:40 +00:00
|
|
|
};
|
|
|
|
}
|