From 97f20c3011e8059984565282f5d03bc47b042ab7 Mon Sep 17 00:00:00 2001 From: taku0 Date: Fri, 8 Nov 2019 21:04:53 +0900 Subject: [PATCH] rust: keep multiple version. Firefox 70.0.1 and Thunderbird 68.2.2 require older version of rustc. --- pkgs/development/compilers/rust/1_38_0.nix | 20 +++++++++++++++++++ pkgs/development/compilers/rust/1_39_0.nix | 20 +++++++++++++++++++ pkgs/development/compilers/rust/bootstrap.nix | 16 +-------------- pkgs/development/compilers/rust/default.nix | 18 ++++++++++++++--- pkgs/development/compilers/rust/rustc.nix | 6 ++++-- pkgs/top-level/all-packages.nix | 13 ++++++++++-- 6 files changed, 71 insertions(+), 22 deletions(-) create mode 100644 pkgs/development/compilers/rust/1_38_0.nix create mode 100644 pkgs/development/compilers/rust/1_39_0.nix diff --git a/pkgs/development/compilers/rust/1_38_0.nix b/pkgs/development/compilers/rust/1_38_0.nix new file mode 100644 index 000000000000..5260ab201741 --- /dev/null +++ b/pkgs/development/compilers/rust/1_38_0.nix @@ -0,0 +1,20 @@ +import ./default.nix { + rustcVersion = "1.38.0"; + rustcSha256 = "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4"; + + # Note: the version MUST be one version prior to the version we're + # building + bootstrapVersion = "1.37.0"; + + # fetch hashes by running `print-hashes.sh 1.37.0` + bootstrapHashes = { + i686-unknown-linux-gnu = "74510e0e52a55e65a9f716673c2cda4d2bd427e2453541c6993c77c3ec04acf9"; + x86_64-unknown-linux-gnu = "cb573229bfd32928177c3835fdeb62d52da64806b844bc1095c6225b0665a1cb"; + armv7-unknown-linux-gnueabihf = "5b87b877f0ed20c6a09ce26e7a15d8c61b26b62484b97e78a51099d0efefec98"; + aarch64-unknown-linux-gnu = "263ef98fa3a6b2911b56f89c06615cdebf6ef676eb9b2493ad1539602f79b6ba"; + i686-apple-darwin = "e45d0c4d882fc6c404ffa6fe790294f4ea96384a2b48804adbf723f3635477a8"; + x86_64-apple-darwin = "b2310c97ffb964f253c4088c8d29865f876a49da2a45305493af5b5c7a3ca73d"; + }; + + selectRustPackage = pkgs: pkgs.rust_1_38_0; +} diff --git a/pkgs/development/compilers/rust/1_39_0.nix b/pkgs/development/compilers/rust/1_39_0.nix new file mode 100644 index 000000000000..aa29c7a9ff7c --- /dev/null +++ b/pkgs/development/compilers/rust/1_39_0.nix @@ -0,0 +1,20 @@ +import ./default.nix { + rustcVersion = "1.39.0"; + rustcSha256 = "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl"; + + # Note: the version MUST be one version prior to the version we're + # building + bootstrapVersion = "1.38.0"; + + # fetch hashes by running `print-hashes.sh 1.38.0` + bootstrapHashes = { + i686-unknown-linux-gnu = "41aed8a350e24a0cac1444ed99b3dd24a90bc581dd88cb420c6e547d6b5f57af"; + x86_64-unknown-linux-gnu = "adda26b3f0609dbfbdc2019da4a20101879b9db2134fae322a4e863a069ec221"; + armv7-unknown-linux-gnueabihf = "8b1bf1680a61a643d6b5c7a3b1a1ce88448652756395e20ba5846739cbd085c4"; + aarch64-unknown-linux-gnu = "06afd6d525326cea95c3aa658aaa8542eab26f44235565bb16913ac9d12b7bda"; + i686-apple-darwin = "cdbf2807774bed350a3af6f41d7f7dd7ceff28777cde310c3ba90033188eb2f8"; + x86_64-apple-darwin = "bd301b78ddcd5d4553962b115e1dca5436dd3755ed323f86f4485769286a8a5a"; + }; + + selectRustPackage = pkgs: pkgs.rust_1_39_0; +} diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index 2c9239e8dd73..54b2d3016e50 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,20 +1,6 @@ -{ stdenv, fetchurl, callPackage }: +{ stdenv, fetchurl, callPackage, version, hashes }: let - # Note: the version MUST be one version prior to the version we're - # building - version = "1.38.0"; - - # fetch hashes by running `print-hashes.sh 1.38.0` - hashes = { - i686-unknown-linux-gnu = "41aed8a350e24a0cac1444ed99b3dd24a90bc581dd88cb420c6e547d6b5f57af"; - x86_64-unknown-linux-gnu = "adda26b3f0609dbfbdc2019da4a20101879b9db2134fae322a4e863a069ec221"; - armv7-unknown-linux-gnueabihf = "8b1bf1680a61a643d6b5c7a3b1a1ce88448652756395e20ba5846739cbd085c4"; - aarch64-unknown-linux-gnu = "06afd6d525326cea95c3aa658aaa8542eab26f44235565bb16913ac9d12b7bda"; - i686-apple-darwin = "cdbf2807774bed350a3af6f41d7f7dd7ceff28777cde310c3ba90033188eb2f8"; - x86_64-apple-darwin = "bd301b78ddcd5d4553962b115e1dca5436dd3755ed323f86f4485769286a8a5a"; - }; - platform = if stdenv.hostPlatform.system == "i686-linux" then "i686-unknown-linux-gnu" diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index a39cd785cf7c..efd641efb6e6 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -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) { diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index ef02f693f29f..8a7d680010df 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -4,6 +4,8 @@ , pkgconfig, openssl , which, libffi , withBundledLLVM ? false +, version +, sha256 }: let @@ -18,11 +20,11 @@ let llvmShared = llvm_7.override { enableSharedLibraries = true; }; in stdenv.mkDerivation rec { pname = "rustc"; - version = "1.39.0"; + inherit version; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl"; + inherit sha256; }; __darwinAllowLocalNetworking = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2acf3fec71c3..0946106efbb8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8523,10 +8523,18 @@ in inherit (darwin) apple_sdk; }; - rust = callPackage ../development/compilers/rust { + rust_1_39_0 = callPackage ../development/compilers/rust/1_39_0.nix { inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; }; - rustPackages = rust.packages.stable; + rust_1_38_0 = callPackage ../development/compilers/rust/1_38_0.nix { + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; + }; + rust = rust_1_39_0; + + rustPackages_1_39_0 = rust_1_39_0.packages.stable; + rustPackages_1_38_0 = rust_1_38_0.packages.stable; + rustPackages = rustPackages_1_39_0; + inherit (rustPackages) cargo rustc rustPlatform; inherit (rust) makeRustPlatform; @@ -21283,6 +21291,7 @@ in thunderbird = callPackage ../applications/networking/mailreaders/thunderbird { inherit (gnome2) libIDL; + inherit (rustPackages_1_38_0) cargo rustc; libpng = libpng_apng; enableGTK3 = true; };