rust: keep multiple version.

Firefox 70.0.1 and Thunderbird 68.2.2 require older version of rustc.
This commit is contained in:
taku0
2019-11-08 21:12:01 +09:00
parent f2503c14e5
commit 97f20c3011
6 changed files with 71 additions and 22 deletions
+15 -3
View File
@@ -1,3 +1,9 @@
{ rustcVersion
, rustcSha256
, bootstrapVersion
, bootstrapHashes
, selectRustPackage
}:
{ stdenv, lib
, buildPackages
, newScope, callPackage
@@ -36,21 +42,27 @@
# cycles / purify builds). In this way, nixpkgs would be in control of all
# bootstrapping.
packages = {
prebuilt = callPackage ./bootstrap.nix {};
prebuilt = callPackage ./bootstrap.nix {
version = bootstrapVersion;
hashes = bootstrapHashes;
};
stable = lib.makeScope newScope (self: let
# Like `buildRustPackages`, but may also contain prebuilt binaries to
# break cycle. Just like `bootstrapTools` for nixpkgs as a whole,
# nothing in the final package set should refer to this.
bootstrapRustPackages = self.buildRustPackages.overrideScope' (_: _:
lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform)
buildPackages.rust.packages.prebuilt);
(selectRustPackage buildPackages).packages.prebuilt);
bootRustPlatform = makeRustPlatform bootstrapRustPackages;
in {
# Packages suitable for build-time, e.g. `build.rs`-type stuff.
buildRustPackages = buildPackages.rust.packages.stable;
buildRustPackages = (selectRustPackage buildPackages).packages.stable;
# Analogous to stdenv
rustPlatform = makeRustPlatform self.buildRustPackages;
rustc = self.callPackage ./rustc.nix ({
version = rustcVersion;
sha256 = rustcSha256;
# Use boot package set to break cycle
rustPlatform = bootRustPlatform;
} // lib.optionalAttrs (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) {