1{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl
2, targets ? []
3, targetToolchains ? []
4, targetPatches ? []
5}:
6
7let
8 rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}));
9 version = "1.24.0";
10 cargoVersion = "0.24.0";
11 src = fetchurl {
12 url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
13 sha256 = "17v3jpyky8vkkgai5yd2zr8zl87qpgj6dx99gx27x1sf0kv7d0mv";
14 };
15in rec {
16 rustc = callPackage ./rustc.nix {
17 inherit stdenv llvm targets targetPatches targetToolchains rustPlatform version src;
18
19 forceBundledLLVM = true;
20
21 configureFlags = [ "--release-channel=stable" ];
22
23 # 1. Upstream is not running tests on aarch64:
24 # see https://github.com/rust-lang/rust/issues/49807#issuecomment-380860567
25 # So we do the same.
26 # 2. Tests run out of memory for i686
27 doCheck = !stdenv.isAarch64 && !stdenv.isi686;
28
29 patches = [
30 ./patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch
31 ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
32
33 };
34
35 cargo = callPackage ./cargo.nix rec {
36 version = cargoVersion;
37 inherit src;
38 inherit stdenv;
39 inherit rustc; # the rustc that will be wrapped by cargo
40 inherit rustPlatform; # used to build cargo
41 };
42}