From 0720373dfc8ebb8962cdab9ba816c348fa7e6692 Mon Sep 17 00:00:00 2001 From: David Craven Date: Tue, 7 Jun 2016 20:42:51 +0200 Subject: [PATCH 1/4] cargo: Use stable releases instead of snapshots --- .../rustc/{stable.nix => default.nix} | 8 ++- pkgs/development/compilers/rustc/generic.nix | 6 +- .../tools/build-managers/cargo/bootstrap.nix | 50 +++++++++++++++ .../tools/build-managers/cargo/common.nix | 38 ----------- .../tools/build-managers/cargo/default.nix | 55 +++------------- .../tools/build-managers/cargo/generic.nix | 64 +++++++++++++++++++ .../tools/build-managers/cargo/head.nix | 43 ++----------- .../build-managers/cargo/print-hashes.sh | 17 +++++ .../tools/build-managers/cargo/snapshot.nix | 55 ---------------- pkgs/top-level/all-packages.nix | 34 +++------- 10 files changed, 164 insertions(+), 206 deletions(-) rename pkgs/development/compilers/rustc/{stable.nix => default.nix} (60%) create mode 100644 pkgs/development/tools/build-managers/cargo/bootstrap.nix delete mode 100644 pkgs/development/tools/build-managers/cargo/common.nix create mode 100644 pkgs/development/tools/build-managers/cargo/generic.nix create mode 100755 pkgs/development/tools/build-managers/cargo/print-hashes.sh delete mode 100644 pkgs/development/tools/build-managers/cargo/snapshot.nix diff --git a/pkgs/development/compilers/rustc/stable.nix b/pkgs/development/compilers/rustc/default.nix similarity index 60% rename from pkgs/development/compilers/rustc/stable.nix rename to pkgs/development/compilers/rustc/default.nix index 596ef2d0cb7a..dd7fd8a88dab 100644 --- a/pkgs/development/compilers/rustc/stable.nix +++ b/pkgs/development/compilers/rustc/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage }: +{ stdenv, callPackage, targets ? [], targetToolchains ? [] }: callPackage ./generic.nix { shortVersion = "1.9.0"; @@ -6,8 +6,10 @@ callPackage ./generic.nix { forceBundledLLVM = false; configureFlags = [ "--release-channel=stable" ]; srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779"; - srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8"; + srcSha = "167rh7hs77grn895h54s7np7f0k7b6i8z4wdfinncg4chy08hxq1"; patches = [ ./patches/remove-uneeded-git.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - rustc = callPackage ./bootstrap.nix {}; + rustc = callPackage ./snapshot.nix {}; + inherit targets; + inherit targetToolchains; } diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix index 09d8ad8bf00f..42deddd9e1d2 100644 --- a/pkgs/development/compilers/rustc/generic.nix +++ b/pkgs/development/compilers/rustc/generic.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps -, llvm, jemalloc, ncurses, darwin, binutils, rustc +, llvm, jemalloc, ncurses, darwin, binutils, rustc, git , isRelease ? false , shortVersion @@ -112,8 +112,8 @@ stdenv.mkDerivation { ''; # ps is needed for one of the test cases - nativeBuildInputs = [ file python2 procps rustc ]; - buildInputs = [ ncurses ] + nativeBuildInputs = [ file python2 procps rustc git ]; + buildInputs = [ ncurses ] ++ targetToolchains ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared; # https://github.com/rust-lang/rust/issues/30181 diff --git a/pkgs/development/tools/build-managers/cargo/bootstrap.nix b/pkgs/development/tools/build-managers/cargo/bootstrap.nix new file mode 100644 index 000000000000..c4052232a8bb --- /dev/null +++ b/pkgs/development/tools/build-managers/cargo/bootstrap.nix @@ -0,0 +1,50 @@ +{ stdenv, fetchurl, makeWrapper, cacert, zlib, rustc }: + +let + platform = + if stdenv.system == "i686-linux" + then "i686-unknown-linux-gnu" + else if stdenv.system == "x86_64-linux" + then "x86_64-unknown-linux-gnu" + else if stdenv.system == "i686-darwin" + then "i686-apple-darwin" + else if stdenv.system == "x86_64-darwin" + then "x86_64-apple-darwin" + else abort "missing boostrap url for platform ${stdenv.system}"; + + # fetch hashes by running `print-hashes.sh 1.9.0` + bootstrapHash = + if stdenv.system == "i686-linux" + then "dd4d9bf1b9393867eb18d00431e8fb733894984f2c7b5154bc1b64d045077b45" + else if stdenv.system == "x86_64-linux" + then "288ff13efa2577e81c77fc2cb6e2b49b1ed0ceab51b4fa12f7efb87039ac49b7" + else if stdenv.system == "i686-darwin" + then "4d4d4b256d6bd6ae2527cf61007b2553de200f0a1910b7ad41e4f51d2b21e536" + else if stdenv.system == "x86_64-darwin" + then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6" + else throw "missing boostrap hash for platform ${stdenv.system}"; +in +stdenv.mkDerivation rec { + name = "cargo-bootstrap-${version}"; + version = "1.9.0"; + + src = fetchurl { + url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; + sha256 = bootstrapHash; + }; + + passthru.rustc = rustc; + buildInputs = [makeWrapper zlib]; + phases = ["unpackPhase" "installPhase"]; + + installPhase = '' + cp -r cargo "$out" + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/cargo" + + wrapProgram "$out/bin/cargo" \ + --suffix PATH : "${rustc}/bin" + ''; +} diff --git a/pkgs/development/tools/build-managers/cargo/common.nix b/pkgs/development/tools/build-managers/cargo/common.nix deleted file mode 100644 index 649664793192..000000000000 --- a/pkgs/development/tools/build-managers/cargo/common.nix +++ /dev/null @@ -1,38 +0,0 @@ -{stdenv, version, rustc}: - -{ - inherit version; - - name = "cargo-${version}"; - - postInstall = '' - rm "$out/lib/rustlib/components" \ - "$out/lib/rustlib/install.log" \ - "$out/lib/rustlib/rust-installer-version" \ - "$out/lib/rustlib/uninstall.sh" \ - "$out/lib/rustlib/manifest-cargo" - - wrapProgram "$out/bin/cargo" --suffix PATH : "${rustc}/bin" \ - ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''} - ''; - - platform = if stdenv.system == "i686-linux" - then "i686-unknown-linux-gnu" - else if stdenv.system == "x86_64-linux" - then "x86_64-unknown-linux-gnu" - else if stdenv.system == "i686-darwin" - then "i686-apple-darwin" - else if stdenv.system == "x86_64-darwin" - then "x86_64-apple-darwin" - else throw "no snapshot to bootstrap for this platform (missing platform url suffix)"; - - passthru.rustc = rustc; - - meta = with stdenv.lib; { - homepage = http://crates.io; - description = "Downloads your Rust project's dependencies and builds your project"; - maintainers = with maintainers; [ wizeman retrry ]; - license = [ licenses.mit licenses.asl20 ]; - platforms = platforms.linux ++ platforms.darwin; - }; -} diff --git a/pkgs/development/tools/build-managers/cargo/default.nix b/pkgs/development/tools/build-managers/cargo/default.nix index 54909ce3b704..253a62e7bbe2 100644 --- a/pkgs/development/tools/build-managers/cargo/default.nix +++ b/pkgs/development/tools/build-managers/cargo/default.nix @@ -1,49 +1,14 @@ -{ stdenv, lib, cacert, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl -, cmake, zlib, makeWrapper -# Darwin dependencies -, libiconv }: +{ stdenv, callPackage, rustc, makeRustPlatform, recurseIntoAttrs }: -with rustPlatform; - -with ((import ./common.nix) { - inherit stdenv rustc; +let + cargoBootstrap = callPackage ./bootstrap.nix {}; + rustPlatformBootstrap = recurseIntoAttrs (makeRustPlatform cargoBootstrap rustPlatformBootstrap); +in +callPackage ./generic.nix rec { version = "0.10.0"; -}); - -buildRustPackage rec { - inherit name version meta passthru; - - # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules - src = fetchgit { - url = "git://github.com/rust-lang/cargo"; - rev = "refs/tags/${version}"; - sha256 = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; - }; - + srcRev = "refs/tags/${version}"; + srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b"; - - buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ] - ++ lib.optional stdenv.isDarwin libiconv; - - configurePhase = '' - ./configure --enable-optimize --prefix=$out --local-cargo=${cargo}/bin/cargo - ''; - - buildPhase = "make"; - - checkPhase = '' - # Export SSL_CERT_FILE as without it one test fails with SSL verification error - export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt - # Disable cross compilation tests - export CFG_DISABLE_CROSS_TESTS=1 - cargo test - ''; - - # Disable check phase as there are failures (author_prefers_cargo test fails) - doCheck = false; - - installPhase = '' - make install - ${postInstall} - ''; + inherit rustc; + rustPlatform = rustPlatformBootstrap; } diff --git a/pkgs/development/tools/build-managers/cargo/generic.nix b/pkgs/development/tools/build-managers/cargo/generic.nix new file mode 100644 index 000000000000..4f74166bf625 --- /dev/null +++ b/pkgs/development/tools/build-managers/cargo/generic.nix @@ -0,0 +1,64 @@ +{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib +, makeWrapper, libiconv, cacert, rustPlatform, rustc +, version, srcRev, srcSha, depsSha256 }: + +rustPlatform.buildRustPackage rec { + name = "cargo-${version}"; + inherit version; + + src = fetchgit { + url = "https://github.com/rust-lang/cargo"; + rev = srcRev; + sha256 = srcSha; + }; + + inherit depsSha256; + + passthru.rustc = rustc; + + buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ] + ++ stdenv.lib.optional stdenv.isDarwin libiconv; + + configurePhase = '' + ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.cargo}/bin/cargo + ''; + + buildPhase = "make"; + + installPhase = '' + make install + ${postInstall} + ''; + + postInstall = '' + rm "$out/lib/rustlib/components" \ + "$out/lib/rustlib/install.log" \ + "$out/lib/rustlib/rust-installer-version" \ + "$out/lib/rustlib/uninstall.sh" \ + "$out/lib/rustlib/manifest-cargo" + + wrapProgram "$out/bin/cargo" \ + --suffix PATH : "${rustc}/bin" \ + --run "export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" \ + ${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''} + ''; + + checkPhase = '' + # Export SSL_CERT_FILE as without it one test fails with SSL verification error + export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt + # Disable cross compilation tests + export CFG_DISABLE_CROSS_TESTS=1 + cargo test + ''; + + # Disable check phase as there are failures (author_prefers_cargo test fails) + doCheck = false; + + meta = with stdenv.lib; { + homepage = http://crates.io; + description = "Downloads your Rust project's dependencies and builds your project"; + maintainers = with maintainers; [ wizeman retrry ]; + license = [ licenses.mit licenses.asl20 ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/pkgs/development/tools/build-managers/cargo/head.nix b/pkgs/development/tools/build-managers/cargo/head.nix index 475e2ab962c8..0faaf5e9a719 100644 --- a/pkgs/development/tools/build-managers/cargo/head.nix +++ b/pkgs/development/tools/build-managers/cargo/head.nix @@ -1,39 +1,10 @@ -{ stdenv, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl -, cmake, zlib, makeWrapper }: - -with rustPlatform; - -with ((import ./common.nix) { - inherit stdenv rustc; - version = "2016-03-20"; -}); - -buildRustPackage rec { - inherit name version meta passthru; - - # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules - src = fetchgit { - url = "git://github.com/rust-lang/cargo"; - rev = "7d79da08238e3d47e0bc4406155bdcc45ccb8c82"; - sha256 = "190qdii53s4vk940yzs2iizhfs22y2v8bzw051bl6bk9bs3y4fdd"; - }; +{ stdenv, callPackage, rustc, rustPlatform }: +callPackage ./generic.nix rec { + version = "2016.06.07"; + srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28"; + srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f"; depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f"; - - buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]; - - configurePhase = '' - ./configure --enable-optimize --prefix=$out --local-cargo=${cargo}/bin/cargo - ''; - - buildPhase = "make"; - - # Disable check phase as there are lots of failures (some probably due to - # trying to access the network). - doCheck = false; - - installPhase = '' - make install - ${postInstall} - ''; + inherit rustc; + inherit rustPlatform; } diff --git a/pkgs/development/tools/build-managers/cargo/print-hashes.sh b/pkgs/development/tools/build-managers/cargo/print-hashes.sh new file mode 100755 index 000000000000..4d1d20066b85 --- /dev/null +++ b/pkgs/development/tools/build-managers/cargo/print-hashes.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin" +BASEURL="https://static.rust-lang.org/dist" +VERSION=$1 + +if [[ -z $VERSION ]] +then + echo "No version supplied" + exit -1 +fi + +for PLATFORM in $PLATFORMS +do + URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256" + curl $URL +done diff --git a/pkgs/development/tools/build-managers/cargo/snapshot.nix b/pkgs/development/tools/build-managers/cargo/snapshot.nix deleted file mode 100644 index 62539c2c7328..000000000000 --- a/pkgs/development/tools/build-managers/cargo/snapshot.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ stdenv, fetchurl, zlib, makeWrapper, rustc }: - -/* Cargo binary snapshot */ - -let snapshotDate = "2016-01-31"; -in - -with ((import ./common.nix) { - inherit stdenv rustc; - version = "snapshot-${snapshotDate}"; -}); - -let snapshotHash = if stdenv.system == "i686-linux" - then "7e2f9c82e1af5aa43ef3ee2692b985a5f2398f0a" - else if stdenv.system == "x86_64-linux" - then "4c03a3fd2474133c7ad6d8bb5f6af9915ca5292a" - else if stdenv.system == "i686-darwin" - then "4d84d31449a5926f9e7ceb344540d6e5ea530b88" - else if stdenv.system == "x86_64-darwin" - then "f8baef5b0b3e6f9825be1f1709594695ac0f0abc" - else throw "no snapshot for platform ${stdenv.system}"; - snapshotName = "cargo-nightly-${platform}.tar.gz"; -in - -stdenv.mkDerivation { - inherit name version meta passthru; - - src = fetchurl { - url = "https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${snapshotDate}/${snapshotName}"; - sha1 = snapshotHash; - }; - - buildInputs = [ makeWrapper ]; - - dontStrip = true; - - __propagatedImpureHostDeps = [ - "/usr/lib/libiconv.2.dylib" - "/usr/lib/libssl.0.9.8.dylib" - "/usr/lib/libcurl.4.dylib" - "/System/Library/Frameworks/GSS.framework/GSS" - "/System/Library/Frameworks/GSS.framework/Versions/Current" - "/System/Library/PrivateFrameworks/Heimdal.framework/Heimdal" - "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/Current" - ]; - - installPhase = '' - mkdir -p "$out" - ./install.sh "--prefix=$out" - '' + (if stdenv.isLinux then '' - patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \ - --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/:${zlib.out}/lib" \ - "$out/bin/cargo" - '' else "") + postInstall; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6007aa1afb00..b4653fcbb1d5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2527,7 +2527,7 @@ in netatalk = callPackage ../tools/filesystems/netatalk { }; netcdf = callPackage ../development/libraries/netcdf { }; - + netcdf-mpi = appendToName "mpi" (netcdf.override { hdf5 = hdf5-mpi; }); @@ -4491,7 +4491,7 @@ in inherit (self.haskellPackages) ghc; cabal-install = haskell.lib.disableSharedExecutables haskellPackages.cabal-install; - + stack = haskell.lib.overrideCabal haskellPackages.stack (drv: { enableSharedExecutables = false; isLibrary = false; @@ -5262,18 +5262,14 @@ in rtags = callPackage ../development/tools/rtags/default.nix {}; rustc = rustcStable; - rustcStable = callPackage ../development/compilers/rustc/stable.nix {}; + rustcStable = callPackage ../development/compilers/rustc {}; rustcBeta = lowPrio (callPackage ../development/compilers/rustc/beta.nix {}); rustcUnstable = lowPrio (callPackage ../development/compilers/rustc/head.nix {}); - rustPlatform = rustStable; - rustStable = recurseIntoAttrs (makeRustPlatform cargo rustStable); - rustBeta = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustBeta)); - rustUnstable = lowPrio (recurseIntoAttrs (makeRustPlatform cargoUnstable rustUnstable)); + cargo = callPackage ../development/tools/build-managers/cargo {}; + cargoUnstable = lowPrio (callPackage ../development/tools/build-managers/cargo/head.nix {}); - # rust platform to build cargo itself (with cargoSnapshot) - rustCargoPlatform = makeRustPlatform (cargoSnapshot rustcStable) rustCargoPlatform; - rustUnstableCargoPlatform = makeRustPlatform (cargoSnapshot rustcUnstable) rustUnstableCargoPlatform; + rustPlatform = recurseIntoAttrs (makeRustPlatform cargo rustPlatform); makeRustPlatform = cargo: self: let @@ -5955,20 +5951,6 @@ in byacc = callPackage ../development/tools/parsing/byacc { }; - cargo = callPackage ../development/tools/build-managers/cargo { - # cargo needs to be built with rustCargoPlatform, which uses cargoSnapshot - rustPlatform = rustCargoPlatform; - }; - - cargoUnstable = lowPrio (callPackage ../development/tools/build-managers/cargo/head.nix { - rustPlatform = rustUnstableCargoPlatform; - }); - - cargoSnapshot = rustc: - callPackage ../development/tools/build-managers/cargo/snapshot.nix { - inherit rustc; - }; - casperjs = callPackage ../development/tools/casperjs { inherit (texFunctions) fontsConf; }; @@ -10840,7 +10822,7 @@ in batman_adv = callPackage ../os-specific/linux/batman-adv {}; bcc = callPackage ../os-specific/linux/bcc { }; - + bbswitch = callPackage ../os-specific/linux/bbswitch {}; ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { }; @@ -16015,7 +15997,7 @@ in openspecfun = callPackage ../development/libraries/science/math/openspecfun {}; - magma = callPackage ../development/libraries/science/math/magma { }; + magma = callPackage ../development/libraries/science/math/magma { }; mathematica = callPackage ../applications/science/math/mathematica { }; mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { }; From 447dce99da1a92c0efa2810ae9e9d592152a7586 Mon Sep 17 00:00:00 2001 From: David Craven Date: Tue, 7 Jun 2016 20:53:25 +0200 Subject: [PATCH 2/4] rustc: Enable crosscompiling std crates --- pkgs/development/compilers/rustc/beta.nix | 4 ++- pkgs/development/compilers/rustc/generic.nix | 29 ++++---------------- pkgs/development/compilers/rustc/head.nix | 4 ++- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/pkgs/development/compilers/rustc/beta.nix b/pkgs/development/compilers/rustc/beta.nix index 7dbd8ae7a695..363dc71c02da 100644 --- a/pkgs/development/compilers/rustc/beta.nix +++ b/pkgs/development/compilers/rustc/beta.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, rustcStable }: +{ stdenv, callPackage, rustcStable, targets ? [], targetToolchains ? [] }: callPackage ./generic.nix { shortVersion = "beta-1.10.0"; @@ -9,4 +9,6 @@ callPackage ./generic.nix { patches = [ ./patches/disable-lockfile-check.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; rustc = rustcStable; + inherit targets; + inherit targetToolchains; } diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix index 42deddd9e1d2..a08843f494e9 100644 --- a/pkgs/development/compilers/rustc/generic.nix +++ b/pkgs/development/compilers/rustc/generic.nix @@ -7,22 +7,10 @@ , srcSha, srcRev , configureFlags ? [] , patches +, targets +, targetToolchains } @ args: -/* Rust's build process has a few quirks : - -- The Rust compiler is written is Rust, so it requires a bootstrap - compiler, which is downloaded during the build. To make the build - pure, we download it ourself before and put it where it is - expected. Once the language is stable (1.0) , we might want to - switch it to use nix's packaged rust compiler. This might not be possible - as the compiler is highly coupled to the bootstrap. - -NOTE : some derivation depend on rust. When updating this, please make -sure those derivations still compile. (racer, for example). - -*/ - let version = if isRelease then "${shortVersion}" @@ -35,15 +23,7 @@ let llvmShared = llvm.override { enableSharedLibraries = true; }; - target = if stdenv.system == "i686-linux" - then "i686-unknown-linux-gnu" - else if stdenv.system == "x86_64-linux" - then "x86_64-unknown-linux-gnu" - else if stdenv.system == "i686-darwin" - then "i686-apple-darwin" - else if stdenv.system == "x86_64-darwin" - then "x86_64-apple-darwin" - else abort "no snapshot to bootstrap for this platform (missing target triple)"; + target = builtins.replaceStrings [" "] [","] (builtins.toString targets); meta = with stdenv.lib; { homepage = http://www.rust-lang.org/; @@ -75,9 +55,11 @@ stdenv.mkDerivation { # ++ [ "--jemalloc-root=${jemalloc}/lib" ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ] ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang" + ++ stdenv.lib.optional (targets != []) "--target=${target}" ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; inherit patches; + passthru.target = target; postPatch = '' substituteInPlace src/rust-installer/gen-install-script.sh \ @@ -125,4 +107,5 @@ stdenv.mkDerivation { preCheck = "export TZDIR=${tzdata}/share/zoneinfo"; doCheck = true; + dontSetConfigureCross = true; } diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix index 8d9373eb3c3d..aa32416c6495 100644 --- a/pkgs/development/compilers/rustc/head.nix +++ b/pkgs/development/compilers/rustc/head.nix @@ -1,5 +1,5 @@ # Please make sure to check if rustfmt still builds when updating nightly -{ stdenv, callPackage, rustcStable }: +{ stdenv, callPackage, rustcStable, targets ? [], targetToolchains ? [] }: callPackage ./generic.nix { shortVersion = "master-1.11.0"; @@ -10,4 +10,6 @@ callPackage ./generic.nix { ./patches/use-rustc-1.9.0.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; rustc = rustcStable; + inherit targets; + inherit targetToolchains; } From d8a7aaf179cfad732720b996c76c55488b8d6d20 Mon Sep 17 00:00:00 2001 From: David Craven Date: Tue, 7 Jun 2016 20:55:14 +0200 Subject: [PATCH 3/4] rustc: Prepare for 1.10.0 release --- .../development/compilers/rustc/bootstrap.nix | 73 ++++++++----------- .../compilers/rustc/print-hashes.sh | 17 +++++ pkgs/development/compilers/rustc/snapshot.nix | 61 ++++++++++++++++ 3 files changed, 109 insertions(+), 42 deletions(-) create mode 100755 pkgs/development/compilers/rustc/print-hashes.sh create mode 100644 pkgs/development/compilers/rustc/snapshot.nix diff --git a/pkgs/development/compilers/rustc/bootstrap.nix b/pkgs/development/compilers/rustc/bootstrap.nix index 8bff511459dc..0361bb78a9ce 100644 --- a/pkgs/development/compilers/rustc/bootstrap.nix +++ b/pkgs/development/compilers/rustc/bootstrap.nix @@ -1,58 +1,47 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, makeWrapper }: let - platform = if stdenv.system == "i686-linux" - then "linux-i386" + platform = + if stdenv.system == "i686-linux" + then "i686-unknown-linux-gnu" else if stdenv.system == "x86_64-linux" - then "linux-x86_64" + then "x86_64-unknown-linux-gnu" else if stdenv.system == "i686-darwin" - then "macos-i386" + then "i686-apple-darwin" else if stdenv.system == "x86_64-darwin" - then "macos-x86_64" - else abort "no snapshot to bootstrap for this platform (missing platform url suffix)"; + then "x86_64-apple-darwin" + else abort "missing boostrap url for platform ${stdenv.system}"; - /* Rust is bootstrapped from an earlier built version. We need - to fetch these earlier versions, which vary per platform. - The shapshot info you want can be found at - https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt - with the set you want at the top. Make sure this is the latest snapshot - for the tagged release and not a snapshot in the current HEAD. - NOTE: Rust 1.9.0 is the last version that uses snapshots - */ - - snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef"; - snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397"; - snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565"; - snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8"; - snapshotDate = "2016-03-18"; - snapshotRev = "235d774"; - - snapshotHash = if stdenv.system == "i686-linux" - then snapshotHashLinux686 + # fetch hashes by running `print-hashes.sh 1.9.0` + bootstrapHash = + if stdenv.system == "i686-linux" + then "2951dec835827974d03c7aafbf2c969f39bb530e1c200fd46f90bc01772fae39" else if stdenv.system == "x86_64-linux" - then snapshotHashLinux64 + then "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" else if stdenv.system == "i686-darwin" - then snapshotHashDarwin686 + then "c7aa93e2475aa8e65259f606ca70e98da41cf5d2b20f91703b98f9572a84f7e6" else if stdenv.system == "x86_64-darwin" - then snapshotHashDarwin64 - else abort "no snapshot for platform ${stdenv.system}"; - - snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2"; + then "7204226b42e9c380d44e722efd4a886178a1867a064c90f12e0553a21a4184c6" + else throw "missing boostrap hash for platform ${stdenv.system}"; in - -stdenv.mkDerivation { - name = "rust-bootstrap"; +stdenv.mkDerivation rec { + name = "rustc-bootstrap-${version}"; + version = "1.9.0"; src = fetchurl { - url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; - sha1 = snapshotHash; + url = "https://static.rust-lang.org/dist/rustc-${version}-${platform}.tar.gz"; + sha256 = bootstrapHash; }; - dontStrip = true; + buildInputs = [makeWrapper]; + phases = ["unpackPhase" "installPhase"]; + installPhase = '' mkdir -p "$out" - cp -r bin "$out/bin" - '' + stdenv.lib.optionalString stdenv.isLinux '' - patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \ - --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \ - "$out/bin/rustc" + ./install.sh "--prefix=$out" + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/rustc" + + wrapProgram "$out/bin/rustc" ''; } diff --git a/pkgs/development/compilers/rustc/print-hashes.sh b/pkgs/development/compilers/rustc/print-hashes.sh new file mode 100755 index 000000000000..710d4c0b585c --- /dev/null +++ b/pkgs/development/compilers/rustc/print-hashes.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin" +BASEURL="https://static.rust-lang.org/dist" +VERSION=$1 + +if [[ -z $VERSION ]] +then + echo "No version supplied" + exit -1 +fi + +for PLATFORM in $PLATFORMS +do + URL="$BASEURL/rustc-$VERSION-$PLATFORM.tar.gz.sha256" + curl $URL +done diff --git a/pkgs/development/compilers/rustc/snapshot.nix b/pkgs/development/compilers/rustc/snapshot.nix new file mode 100644 index 000000000000..8f7005dc0d76 --- /dev/null +++ b/pkgs/development/compilers/rustc/snapshot.nix @@ -0,0 +1,61 @@ +/* NOTE: Rust 1.9.0 is the last version that uses snapshots + This file can be deleted after the 1.10.0 release and bootstrap.nix + can be used instead +*/ +{ stdenv, fetchurl }: + +let + platform = if stdenv.system == "i686-linux" + then "linux-i386" + else if stdenv.system == "x86_64-linux" + then "linux-x86_64" + else if stdenv.system == "i686-darwin" + then "macos-i386" + else if stdenv.system == "x86_64-darwin" + then "macos-x86_64" + else abort "no snapshot to bootstrap for this platform (missing platform url suffix)"; + + /* Rust is bootstrapped from an earlier built version. We need + to fetch these earlier versions, which vary per platform. + The shapshot info you want can be found at + https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt + with the set you want at the top. Make sure this is the latest snapshot + for the tagged release and not a snapshot in the current HEAD. + */ + + snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef"; + snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397"; + snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565"; + snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8"; + snapshotDate = "2016-03-18"; + snapshotRev = "235d774"; + + snapshotHash = if stdenv.system == "i686-linux" + then snapshotHashLinux686 + else if stdenv.system == "x86_64-linux" + then snapshotHashLinux64 + else if stdenv.system == "i686-darwin" + then snapshotHashDarwin686 + else if stdenv.system == "x86_64-darwin" + then snapshotHashDarwin64 + else abort "no snapshot for platform ${stdenv.system}"; + + snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2"; +in + +stdenv.mkDerivation { + name = "rust-bootstrap"; + src = fetchurl { + url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; + sha1 = snapshotHash; + }; + dontStrip = true; + installPhase = '' + mkdir -p "$out" + cp -r bin "$out/bin" + '' + stdenv.lib.optionalString stdenv.isLinux '' + patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \ + --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \ + "$out/bin/rustc" + ''; +} From 54f80775cb58b3aa784b323b1eddb14e45d86fc4 Mon Sep 17 00:00:00 2001 From: David Craven Date: Tue, 14 Jun 2016 12:49:48 +0200 Subject: [PATCH 4/4] rust: Refactoring of rust and cargo packages --- pkgs/build-support/rust/default.nix | 6 +- pkgs/build-support/rust/fetchcargo.nix | 4 +- pkgs/development/compilers/rust/beta.nix | 27 +++++++++ .../cargo => compilers/rust}/bootstrap.nix | 60 ++++++++++++++----- .../generic.nix => compilers/rust/cargo.nix} | 2 +- pkgs/development/compilers/rust/default.nix | 33 ++++++++++ pkgs/development/compilers/rust/head.nix | 27 +++++++++ .../patches/disable-lockfile-check.patch | 0 .../{rustc => rust}/patches/grsec.patch | 0 .../patches/remove-uneeded-git.patch | 0 .../patches/use-rustc-1.9.0.patch | 0 .../cargo => compilers/rust}/print-hashes.sh | 0 .../{rustc/generic.nix => rust/rustc.nix} | 9 +-- .../compilers/{rustc => rust}/snapshot.nix | 34 ++++++----- pkgs/development/compilers/rustc/beta.nix | 14 ----- .../development/compilers/rustc/bootstrap.nix | 47 --------------- pkgs/development/compilers/rustc/default.nix | 15 ----- pkgs/development/compilers/rustc/head.nix | 15 ----- .../compilers/rustc/print-hashes.sh | 17 ------ .../tools/build-managers/cargo/default.nix | 14 ----- .../tools/build-managers/cargo/head.nix | 10 ---- pkgs/development/tools/rust/racer/default.nix | 4 +- .../development/tools/rust/racerd/default.nix | 2 +- pkgs/misc/vim-plugins/default.nix | 4 +- .../vim2nix/additional-nix-code/youcompleteme | 2 +- pkgs/tools/misc/exa/default.nix | 2 +- pkgs/top-level/all-packages.nix | 31 ++++------ 27 files changed, 181 insertions(+), 198 deletions(-) create mode 100644 pkgs/development/compilers/rust/beta.nix rename pkgs/development/{tools/build-managers/cargo => compilers/rust}/bootstrap.nix (53%) rename pkgs/development/{tools/build-managers/cargo/generic.nix => compilers/rust/cargo.nix} (98%) create mode 100644 pkgs/development/compilers/rust/default.nix create mode 100644 pkgs/development/compilers/rust/head.nix rename pkgs/development/compilers/{rustc => rust}/patches/disable-lockfile-check.patch (100%) rename pkgs/development/compilers/{rustc => rust}/patches/grsec.patch (100%) rename pkgs/development/compilers/{rustc => rust}/patches/remove-uneeded-git.patch (100%) rename pkgs/development/compilers/{rustc => rust}/patches/use-rustc-1.9.0.patch (100%) rename pkgs/development/{tools/build-managers/cargo => compilers/rust}/print-hashes.sh (100%) rename pkgs/development/compilers/{rustc/generic.nix => rust/rustc.nix} (93%) rename pkgs/development/compilers/{rustc => rust}/snapshot.nix (74%) delete mode 100644 pkgs/development/compilers/rustc/beta.nix delete mode 100644 pkgs/development/compilers/rustc/bootstrap.nix delete mode 100644 pkgs/development/compilers/rustc/default.nix delete mode 100644 pkgs/development/compilers/rustc/head.nix delete mode 100755 pkgs/development/compilers/rustc/print-hashes.sh delete mode 100644 pkgs/development/tools/build-managers/cargo/default.nix delete mode 100644 pkgs/development/tools/build-managers/cargo/head.nix diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index b889c4f24583..bbea045f6371 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -1,4 +1,4 @@ -{ stdenv, cacert, git, cargo, rustRegistry }: +{ stdenv, cacert, git, rust, rustRegistry }: { name, depsSha256 , src ? null , srcs ? null @@ -10,7 +10,7 @@ let fetchDeps = import ./fetchcargo.nix { - inherit stdenv cacert git cargo rustRegistry; + inherit stdenv cacert git rust rustRegistry; }; cargoDeps = fetchDeps { @@ -23,7 +23,7 @@ in stdenv.mkDerivation (args // { patchRegistryDeps = ./patch-registry-deps; - buildInputs = [ git cargo cargo.rustc ] ++ buildInputs; + buildInputs = [ git rust.cargo rust.rustc ] ++ buildInputs; configurePhase = args.configurePhase or "true"; diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix index 518420002622..1b4983e32597 100644 --- a/pkgs/build-support/rust/fetchcargo.nix +++ b/pkgs/build-support/rust/fetchcargo.nix @@ -1,9 +1,9 @@ -{ stdenv, cacert, git, cargo, rustRegistry }: +{ stdenv, cacert, git, rust, rustRegistry }: { name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }: stdenv.mkDerivation { name = "${name}-fetch"; - buildInputs = [ cargo git ]; + buildInputs = [ rust.cargo rust.rustc git ]; inherit src srcs sourceRoot rustRegistry cargoUpdateHook; phases = "unpackPhase installPhase"; diff --git a/pkgs/development/compilers/rust/beta.nix b/pkgs/development/compilers/rust/beta.nix new file mode 100644 index 000000000000..4b4ee89f981b --- /dev/null +++ b/pkgs/development/compilers/rust/beta.nix @@ -0,0 +1,27 @@ +{ stdenv, callPackage, rustPlatform, + targets ? [], targetToolchains ? [], targetPatches ? [] }: + +rec { + rustc = callPackage ./rustc.nix { + shortVersion = "beta-1.10.0"; + forceBundledLLVM = false; + configureFlags = [ "--release-channel=beta" ]; + srcRev = "d18e321abeecc69e4d1bf9cafba4fba53ddf267d"; + srcSha = "1ck8mbjrq0bzq5xzwgaqdilakwm2ab0xpzqibjycds62ad4yw774"; + patches = [ ./patches/disable-lockfile-check.patch ] + ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; + inherit targets; + inherit targetPatches; + inherit targetToolchains; + inherit rustPlatform; + }; + + cargo = callPackage ./cargo.nix rec { + version = "0.10.0"; + srcRev = "refs/tags/${version}"; + srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; + depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b"; + inherit rustc; # the rustc that will be wrapped by cargo + inherit rustPlatform; # used to build cargo + }; +} diff --git a/pkgs/development/tools/build-managers/cargo/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix similarity index 53% rename from pkgs/development/tools/build-managers/cargo/bootstrap.nix rename to pkgs/development/compilers/rust/bootstrap.nix index c4052232a8bb..300f69294532 100644 --- a/pkgs/development/tools/build-managers/cargo/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, makeWrapper, cacert, zlib, rustc }: +{ stdenv, fetchurl, makeWrapper, cacert, zlib }: let platform = @@ -23,28 +23,56 @@ let else if stdenv.system == "x86_64-darwin" then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6" else throw "missing boostrap hash for platform ${stdenv.system}"; -in -stdenv.mkDerivation rec { - name = "cargo-bootstrap-${version}"; - version = "1.9.0"; src = fetchurl { url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; sha256 = bootstrapHash; }; - passthru.rustc = rustc; - buildInputs = [makeWrapper zlib]; - phases = ["unpackPhase" "installPhase"]; + version = "1.9.0"; +in - installPhase = '' - cp -r cargo "$out" +rec { + rustc = stdenv.mkDerivation rec { + name = "rustc-bootstrap-${version}"; - patchelf \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/cargo" + inherit version; + inherit src; - wrapProgram "$out/bin/cargo" \ - --suffix PATH : "${rustc}/bin" - ''; + buildInputs = [ makeWrapper ]; + phases = ["unpackPhase" "installPhase"]; + + installPhase = '' + ./install.sh --prefix=$out \ + --components=rustc,rust-std-${platform},rust-docs + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/rustc" + + wrapProgram "$out/bin/rustc" + ''; + }; + + cargo = stdenv.mkDerivation rec { + name = "cargo-bootstrap-${version}"; + + inherit version; + inherit src; + + buildInputs = [ makeWrapper zlib rustc ]; + phases = ["unpackPhase" "installPhase"]; + + installPhase = '' + ./install.sh --prefix=$out \ + --components=cargo + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/cargo" + + wrapProgram "$out/bin/cargo" \ + --suffix PATH : "${rustc}/bin" + ''; + }; } diff --git a/pkgs/development/tools/build-managers/cargo/generic.nix b/pkgs/development/compilers/rust/cargo.nix similarity index 98% rename from pkgs/development/tools/build-managers/cargo/generic.nix rename to pkgs/development/compilers/rust/cargo.nix index 4f74166bf625..fc4bf732cf6b 100644 --- a/pkgs/development/tools/build-managers/cargo/generic.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec { ++ stdenv.lib.optional stdenv.isDarwin libiconv; configurePhase = '' - ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.cargo}/bin/cargo + ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.rust.cargo}/bin/cargo ''; buildPhase = "make"; diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix new file mode 100644 index 000000000000..d1e7460fa54c --- /dev/null +++ b/pkgs/development/compilers/rust/default.nix @@ -0,0 +1,33 @@ +{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, + targets ? [], targetToolchains ? [], targetPatches ? [] }: + +let + rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}) rustPlatform); + rustSnapshotPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./snapshot.nix {}) rustPlatform); +in + +rec { + rustc = callPackage ./rustc.nix { + shortVersion = "1.9.0"; + isRelease = true; + forceBundledLLVM = false; + configureFlags = [ "--release-channel=stable" ]; + srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779"; + srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8"; + patches = [ ./patches/remove-uneeded-git.patch ] + ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; + inherit targets; + inherit targetPatches; + inherit targetToolchains; + rustPlatform = rustSnapshotPlatform; + }; + + cargo = callPackage ./cargo.nix rec { + version = "0.10.0"; + srcRev = "refs/tags/${version}"; + srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; + depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b"; + inherit rustc; # the rustc that will be wrapped by cargo + inherit rustPlatform; # used to build cargo + }; +} diff --git a/pkgs/development/compilers/rust/head.nix b/pkgs/development/compilers/rust/head.nix new file mode 100644 index 000000000000..bbfe5c9a1529 --- /dev/null +++ b/pkgs/development/compilers/rust/head.nix @@ -0,0 +1,27 @@ +{ stdenv, callPackage, rustPlatform, + targets ? [], targetToolchains ? [], targetPatches ? [] }: + +rec { + rustc = callPackage ./rustc.nix { + shortVersion = "master-1.11.0"; + forceBundledLLVM = false; + srcRev = "298730e7032cd55809423773da397cd5c7d827d4"; + srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1"; + patches = [ ./patches/disable-lockfile-check.patch + ./patches/use-rustc-1.9.0.patch ] + ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; + inherit targets; + inherit targetPatches; + inherit targetToolchains; + inherit rustPlatform; + }; + + cargo = callPackage ./cargo.nix rec { + version = "2016.06.07"; + srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28"; + srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f"; + depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f"; + inherit rustc; # the rustc that will be wrapped by cargo + inherit rustPlatform; # used to build cargo + }; +} diff --git a/pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch b/pkgs/development/compilers/rust/patches/disable-lockfile-check.patch similarity index 100% rename from pkgs/development/compilers/rustc/patches/disable-lockfile-check.patch rename to pkgs/development/compilers/rust/patches/disable-lockfile-check.patch diff --git a/pkgs/development/compilers/rustc/patches/grsec.patch b/pkgs/development/compilers/rust/patches/grsec.patch similarity index 100% rename from pkgs/development/compilers/rustc/patches/grsec.patch rename to pkgs/development/compilers/rust/patches/grsec.patch diff --git a/pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch b/pkgs/development/compilers/rust/patches/remove-uneeded-git.patch similarity index 100% rename from pkgs/development/compilers/rustc/patches/remove-uneeded-git.patch rename to pkgs/development/compilers/rust/patches/remove-uneeded-git.patch diff --git a/pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch b/pkgs/development/compilers/rust/patches/use-rustc-1.9.0.patch similarity index 100% rename from pkgs/development/compilers/rustc/patches/use-rustc-1.9.0.patch rename to pkgs/development/compilers/rust/patches/use-rustc-1.9.0.patch diff --git a/pkgs/development/tools/build-managers/cargo/print-hashes.sh b/pkgs/development/compilers/rust/print-hashes.sh similarity index 100% rename from pkgs/development/tools/build-managers/cargo/print-hashes.sh rename to pkgs/development/compilers/rust/print-hashes.sh diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rust/rustc.nix similarity index 93% rename from pkgs/development/compilers/rustc/generic.nix rename to pkgs/development/compilers/rust/rustc.nix index a08843f494e9..b1b33d57bb25 100644 --- a/pkgs/development/compilers/rustc/generic.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps -, llvm, jemalloc, ncurses, darwin, binutils, rustc, git +, llvm, jemalloc, ncurses, darwin, binutils, rustPlatform, git , isRelease ? false , shortVersion @@ -8,6 +8,7 @@ , configureFlags ? [] , patches , targets +, targetPatches , targetToolchains } @ args: @@ -51,14 +52,14 @@ stdenv.mkDerivation { # We need rust to build rust. If we don't provide it, configure will try to download it. configureFlags = configureFlags - ++ [ "--enable-local-rust" "--local-rust-root=${rustc}" "--enable-rpath" ] + ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ] # ++ [ "--jemalloc-root=${jemalloc}/lib" ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ] ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang" ++ stdenv.lib.optional (targets != []) "--target=${target}" ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; - inherit patches; + patches = patches ++ targetPatches; passthru.target = target; postPatch = '' @@ -94,7 +95,7 @@ stdenv.mkDerivation { ''; # ps is needed for one of the test cases - nativeBuildInputs = [ file python2 procps rustc git ]; + nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git ]; buildInputs = [ ncurses ] ++ targetToolchains ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared; diff --git a/pkgs/development/compilers/rustc/snapshot.nix b/pkgs/development/compilers/rust/snapshot.nix similarity index 74% rename from pkgs/development/compilers/rustc/snapshot.nix rename to pkgs/development/compilers/rust/snapshot.nix index 8f7005dc0d76..47f271b18e06 100644 --- a/pkgs/development/compilers/rustc/snapshot.nix +++ b/pkgs/development/compilers/rust/snapshot.nix @@ -2,7 +2,7 @@ This file can be deleted after the 1.10.0 release and bootstrap.nix can be used instead */ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, callPackage }: let platform = if stdenv.system == "i686-linux" @@ -43,19 +43,23 @@ let snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2"; in -stdenv.mkDerivation { - name = "rust-bootstrap"; - src = fetchurl { - url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; - sha1 = snapshotHash; +rec { + rustc = stdenv.mkDerivation { + name = "rustc-snapshot"; + src = fetchurl { + url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; + sha1 = snapshotHash; + }; + dontStrip = true; + installPhase = '' + mkdir -p "$out" + cp -r bin "$out/bin" + '' + stdenv.lib.optionalString stdenv.isLinux '' + patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \ + --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \ + "$out/bin/rustc" + ''; }; - dontStrip = true; - installPhase = '' - mkdir -p "$out" - cp -r bin "$out/bin" - '' + stdenv.lib.optionalString stdenv.isLinux '' - patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \ - --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \ - "$out/bin/rustc" - ''; + + cargo = null; } diff --git a/pkgs/development/compilers/rustc/beta.nix b/pkgs/development/compilers/rustc/beta.nix deleted file mode 100644 index 363dc71c02da..000000000000 --- a/pkgs/development/compilers/rustc/beta.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ stdenv, callPackage, rustcStable, targets ? [], targetToolchains ? [] }: - -callPackage ./generic.nix { - shortVersion = "beta-1.10.0"; - forceBundledLLVM = false; - configureFlags = [ "--release-channel=beta" ]; - srcRev = "39f3c16cca889ef3f1719d9177e3315258222a65"; - srcSha = "01bx6616lslp2mbj4h8bb6m042fs0y1z8g0jgpxvbk3fbhzwafrx"; - patches = [ ./patches/disable-lockfile-check.patch ] ++ - stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - rustc = rustcStable; - inherit targets; - inherit targetToolchains; -} diff --git a/pkgs/development/compilers/rustc/bootstrap.nix b/pkgs/development/compilers/rustc/bootstrap.nix deleted file mode 100644 index 0361bb78a9ce..000000000000 --- a/pkgs/development/compilers/rustc/bootstrap.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ stdenv, fetchurl, makeWrapper }: - -let - platform = - if stdenv.system == "i686-linux" - then "i686-unknown-linux-gnu" - else if stdenv.system == "x86_64-linux" - then "x86_64-unknown-linux-gnu" - else if stdenv.system == "i686-darwin" - then "i686-apple-darwin" - else if stdenv.system == "x86_64-darwin" - then "x86_64-apple-darwin" - else abort "missing boostrap url for platform ${stdenv.system}"; - - # fetch hashes by running `print-hashes.sh 1.9.0` - bootstrapHash = - if stdenv.system == "i686-linux" - then "2951dec835827974d03c7aafbf2c969f39bb530e1c200fd46f90bc01772fae39" - else if stdenv.system == "x86_64-linux" - then "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" - else if stdenv.system == "i686-darwin" - then "c7aa93e2475aa8e65259f606ca70e98da41cf5d2b20f91703b98f9572a84f7e6" - else if stdenv.system == "x86_64-darwin" - then "7204226b42e9c380d44e722efd4a886178a1867a064c90f12e0553a21a4184c6" - else throw "missing boostrap hash for platform ${stdenv.system}"; -in -stdenv.mkDerivation rec { - name = "rustc-bootstrap-${version}"; - version = "1.9.0"; - src = fetchurl { - url = "https://static.rust-lang.org/dist/rustc-${version}-${platform}.tar.gz"; - sha256 = bootstrapHash; - }; - buildInputs = [makeWrapper]; - phases = ["unpackPhase" "installPhase"]; - - installPhase = '' - mkdir -p "$out" - ./install.sh "--prefix=$out" - - patchelf \ - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - "$out/bin/rustc" - - wrapProgram "$out/bin/rustc" - ''; -} diff --git a/pkgs/development/compilers/rustc/default.nix b/pkgs/development/compilers/rustc/default.nix deleted file mode 100644 index dd7fd8a88dab..000000000000 --- a/pkgs/development/compilers/rustc/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ stdenv, callPackage, targets ? [], targetToolchains ? [] }: - -callPackage ./generic.nix { - shortVersion = "1.9.0"; - isRelease = true; - forceBundledLLVM = false; - configureFlags = [ "--release-channel=stable" ]; - srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779"; - srcSha = "167rh7hs77grn895h54s7np7f0k7b6i8z4wdfinncg4chy08hxq1"; - patches = [ ./patches/remove-uneeded-git.patch ] - ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - rustc = callPackage ./snapshot.nix {}; - inherit targets; - inherit targetToolchains; -} diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix deleted file mode 100644 index aa32416c6495..000000000000 --- a/pkgs/development/compilers/rustc/head.nix +++ /dev/null @@ -1,15 +0,0 @@ -# Please make sure to check if rustfmt still builds when updating nightly -{ stdenv, callPackage, rustcStable, targets ? [], targetToolchains ? [] }: - -callPackage ./generic.nix { - shortVersion = "master-1.11.0"; - forceBundledLLVM = false; - srcRev = "298730e7032cd55809423773da397cd5c7d827d4"; - srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1"; - patches = [ ./patches/disable-lockfile-check.patch - ./patches/use-rustc-1.9.0.patch ] ++ - stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - rustc = rustcStable; - inherit targets; - inherit targetToolchains; -} diff --git a/pkgs/development/compilers/rustc/print-hashes.sh b/pkgs/development/compilers/rustc/print-hashes.sh deleted file mode 100755 index 710d4c0b585c..000000000000 --- a/pkgs/development/compilers/rustc/print-hashes.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin" -BASEURL="https://static.rust-lang.org/dist" -VERSION=$1 - -if [[ -z $VERSION ]] -then - echo "No version supplied" - exit -1 -fi - -for PLATFORM in $PLATFORMS -do - URL="$BASEURL/rustc-$VERSION-$PLATFORM.tar.gz.sha256" - curl $URL -done diff --git a/pkgs/development/tools/build-managers/cargo/default.nix b/pkgs/development/tools/build-managers/cargo/default.nix deleted file mode 100644 index 253a62e7bbe2..000000000000 --- a/pkgs/development/tools/build-managers/cargo/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ stdenv, callPackage, rustc, makeRustPlatform, recurseIntoAttrs }: - -let - cargoBootstrap = callPackage ./bootstrap.nix {}; - rustPlatformBootstrap = recurseIntoAttrs (makeRustPlatform cargoBootstrap rustPlatformBootstrap); -in -callPackage ./generic.nix rec { - version = "0.10.0"; - srcRev = "refs/tags/${version}"; - srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2"; - depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b"; - inherit rustc; - rustPlatform = rustPlatformBootstrap; -} diff --git a/pkgs/development/tools/build-managers/cargo/head.nix b/pkgs/development/tools/build-managers/cargo/head.nix deleted file mode 100644 index 0faaf5e9a719..000000000000 --- a/pkgs/development/tools/build-managers/cargo/head.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ stdenv, callPackage, rustc, rustPlatform }: - -callPackage ./generic.nix rec { - version = "2016.06.07"; - srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28"; - srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f"; - depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f"; - inherit rustc; - inherit rustPlatform; -} diff --git a/pkgs/development/tools/rust/racer/default.nix b/pkgs/development/tools/rust/racer/default.nix index 76f5354d596d..0f4477c9b3ff 100644 --- a/pkgs/development/tools/rust/racer/default.nix +++ b/pkgs/development/tools/rust/racer/default.nix @@ -17,13 +17,13 @@ buildRustPackage rec { buildInputs = [ makeWrapper ]; preCheck = '' - export RUST_SRC;_PATH="${rustc.src}/src" + export RUST_SRC;_PATH="${rustPlatform.rust.rustc.src}/src" ''; installPhase = '' mkdir -p $out/bin cp -p target/release/racer $out/bin/ - wrapProgram $out/bin/racer --set RUST_SRC_PATH "${rustc.src}/src" + wrapProgram $out/bin/racer --set RUST_SRC_PATH "${rustPlatform.rust.rustc.src}/src" ''; meta = with stdenv.lib; { diff --git a/pkgs/development/tools/rust/racerd/default.nix b/pkgs/development/tools/rust/racerd/default.nix index a5a3418388d6..d1e3ba8b0cb7 100644 --- a/pkgs/development/tools/rust/racerd/default.nix +++ b/pkgs/development/tools/rust/racerd/default.nix @@ -17,7 +17,7 @@ buildRustPackage rec { buildInputs = [ makeWrapper ]; - RUST_SRC_PATH = ''${rustc.src}/src''; + RUST_SRC_PATH = ''${rustPlatform.rust.rustc.src}/src''; installPhase = '' mkdir -p $out/bin diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index f6f6f68d89a0..8a36263ebb6a 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -1,7 +1,7 @@ # TODO check that no license information gets lost { fetchurl, bash, stdenv, python, go, cmake, vim, vimUtils, perl, ruby, unzip , which, fetchgit, fetchFromGitHub, fetchhg, fetchzip, llvmPackages, zip -, vim_configurable, vimPlugins, xkb_switch, git, racerdRust, fzf +, vim_configurable, vimPlugins, xkb_switch, git, rustracerd, fzf , Cocoa ? null }: @@ -1116,7 +1116,7 @@ rec { ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa; propogatedBuildInputs = [ - racerdRust + rustracerd ]; buildPhase = '' diff --git a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme index 12bcf53f1e04..a27b1f053a29 100644 --- a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme +++ b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme @@ -5,7 +5,7 @@ ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa; propogatedBuildInputs = [ - racerdRust + rustracerd ]; buildPhase = '' diff --git a/pkgs/tools/misc/exa/default.nix b/pkgs/tools/misc/exa/default.nix index 39ba9bb2e509..14d1417e5a42 100644 --- a/pkgs/tools/misc/exa/default.nix +++ b/pkgs/tools/misc/exa/default.nix @@ -6,7 +6,7 @@ buildRustPackage rec { name = "exa-${version}"; version = "2016-04-20"; - depsSha256 = "1rpynsni2r3gim10xc1qkj51wpbzafwsr99y61zh41v4vh047g1k"; + depsSha256 = "0dm8zaxy29pfbq68ysssab9i06sj4azgi3vib9617rklg7w3hdmk"; src = fetchFromGitHub { owner = "ogham"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b4653fcbb1d5..298c7f1c07ac 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5261,32 +5261,31 @@ in rtags = callPackage ../development/tools/rtags/default.nix {}; - rustc = rustcStable; - rustcStable = callPackage ../development/compilers/rustc {}; - rustcBeta = lowPrio (callPackage ../development/compilers/rustc/beta.nix {}); - rustcUnstable = lowPrio (callPackage ../development/compilers/rustc/head.nix {}); + rust = rustStable; + rustStable = callPackage ../development/compilers/rust {}; + rustBeta = lowPrio (callPackage ../development/compilers/rust/beta.nix {}); + rustUnstable = lowPrio (callPackage ../development/compilers/rust/head.nix {}); - cargo = callPackage ../development/tools/build-managers/cargo {}; - cargoUnstable = lowPrio (callPackage ../development/tools/build-managers/cargo/head.nix {}); + cargo = rust.cargo; + rustc = rust.rustc; + rustPlatform = recurseIntoAttrs (makeRustPlatform rust rustPlatform); - rustPlatform = recurseIntoAttrs (makeRustPlatform cargo rustPlatform); - - makeRustPlatform = cargo: self: + makeRustPlatform = rust: self: let callPackage = newScope self; in { - inherit cargo; - - rustc = cargo.rustc; + inherit rust; rustRegistry = callPackage ./rust-packages.nix { }; buildRustPackage = callPackage ../build-support/rust { - inherit cargo; + inherit rust; }; }; rustfmt = callPackage ../development/tools/rust/rustfmt { }; + rustracer = callPackage ../development/tools/rust/racer { }; + rustracerd = callPackage ../development/tools/rust/racerd { }; sbclBootstrap = callPackage ../development/compilers/sbcl/bootstrap.nix {}; sbcl = callPackage ../development/compilers/sbcl {}; @@ -6363,10 +6362,6 @@ in withDocumentation = false; # 'true' is currently broken with qt>=5.5 }; - racerRust = callPackage ../development/tools/rust/racer { }; - - racerdRust = callPackage ../development/tools/rust/racerd { }; - radare = callPackage ../development/tools/analysis/radare { inherit (gnome) vte; lua = lua5; @@ -7494,7 +7489,7 @@ in }; libkrb5 = self.krb5Full.override { type = "lib"; }; - lasso = callPackage ../development/libraries/lasso { }; + lasso = callPackage ../development/libraries/lasso { }; LASzip = callPackage ../development/libraries/LASzip { };