|
|
|
@ -149,11 +149,8 @@ let |
|
|
|
|
in |
|
|
|
|
map (tuple: { name = tuple.name; src = (getFetchUrl pkgs tuple.name tuple.target stdenv fetchurl); }) pkgsTuplesToInstall; |
|
|
|
|
|
|
|
|
|
installComponents = stdenv: namesAndSrcs: |
|
|
|
|
let |
|
|
|
|
inherit (builtins) map; |
|
|
|
|
installComponent = name: src: |
|
|
|
|
stdenv.mkDerivation { |
|
|
|
|
self.stdenv.mkDerivation { |
|
|
|
|
inherit name; |
|
|
|
|
inherit src; |
|
|
|
|
|
|
|
|
@ -239,8 +236,35 @@ let |
|
|
|
|
|
|
|
|
|
dontStrip = true; |
|
|
|
|
}; |
|
|
|
|
in |
|
|
|
|
map (nameAndSrc: (installComponent nameAndSrc.name nameAndSrc.src)) namesAndSrcs; |
|
|
|
|
|
|
|
|
|
aggregateComponents = { pname, version, namesAndSrcs }: |
|
|
|
|
self.pkgs.symlinkJoin { |
|
|
|
|
name = pname + "-" + version; |
|
|
|
|
inherit pname version; |
|
|
|
|
|
|
|
|
|
paths = builtins.map ({ name, src }: (installComponent name src)) namesAndSrcs; |
|
|
|
|
|
|
|
|
|
postBuild = '' |
|
|
|
|
# If rustc or rustdoc is in the derivation, we need to copy their |
|
|
|
|
# executable into the final derivation. This is required |
|
|
|
|
# for making them find the correct SYSROOT. |
|
|
|
|
for target in $out/bin/{rustc,rustdoc}; do |
|
|
|
|
if [ -e $target ]; then |
|
|
|
|
cp --remove-destination "$(realpath -e $target)" $target |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
''; |
|
|
|
|
|
|
|
|
|
# Add the compiler as part of the propagated build inputs in order |
|
|
|
|
# to run: |
|
|
|
|
# |
|
|
|
|
# $ nix-shell -p rustChannels.stable.rust |
|
|
|
|
# |
|
|
|
|
# And get a fully working Rust compiler, with the stdenv linker. |
|
|
|
|
propagatedBuildInputs = [ self.stdenv.cc ]; |
|
|
|
|
|
|
|
|
|
meta.platforms = self.lib.platforms.all; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# Genereate the toolchain set from a parsed manifest. |
|
|
|
|
# |
|
|
|
@ -290,35 +314,10 @@ let |
|
|
|
|
extensions' = map maybeRename extensions; |
|
|
|
|
targetExtensions' = map maybeRename targetExtensions; |
|
|
|
|
namesAndSrcs = getComponents pkgs.pkg name targets extensions' targetExtensions' stdenv fetchurl; |
|
|
|
|
components = installComponents stdenv namesAndSrcs; |
|
|
|
|
componentsOuts = builtins.map (comp: (super.lib.strings.escapeNixString (super.lib.getOutput "out" comp))) components; |
|
|
|
|
in |
|
|
|
|
super.pkgs.symlinkJoin { |
|
|
|
|
name = name + "-" + version; |
|
|
|
|
aggregateComponents { |
|
|
|
|
pname = name; |
|
|
|
|
inherit version; |
|
|
|
|
|
|
|
|
|
paths = components; |
|
|
|
|
postBuild = '' |
|
|
|
|
# If rustc or rustdoc is in the derivation, we need to copy their |
|
|
|
|
# executable into the final derivation. This is required |
|
|
|
|
# for making them find the correct SYSROOT. |
|
|
|
|
for target in $out/bin/{rustc,rustdoc}; do |
|
|
|
|
if [ -e $target ]; then |
|
|
|
|
cp --remove-destination "$(realpath -e $target)" $target |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
''; |
|
|
|
|
|
|
|
|
|
# Add the compiler as part of the propagated build inputs in order |
|
|
|
|
# to run: |
|
|
|
|
# |
|
|
|
|
# $ nix-shell -p rustChannels.stable.rust |
|
|
|
|
# |
|
|
|
|
# And get a fully working Rust compiler, with the stdenv linker. |
|
|
|
|
propagatedBuildInputs = [ stdenv.cc ]; |
|
|
|
|
|
|
|
|
|
meta.platforms = stdenv.lib.platforms.all; |
|
|
|
|
inherit version namesAndSrcs; |
|
|
|
|
} |
|
|
|
|
) { |
|
|
|
|
extensions = []; |
|
|
|
@ -339,6 +338,35 @@ let |
|
|
|
|
# Override all pkgs of a toolchain set. |
|
|
|
|
overrideToolchain = attrs: super.lib.mapAttrs (name: pkg: pkg.override attrs); |
|
|
|
|
|
|
|
|
|
# From a git revision of rustc. |
|
|
|
|
# This does the same thing as crate `rustup-toolchain-install-master`. |
|
|
|
|
# But you need to manually provide component hashes. |
|
|
|
|
fromRustcRev = { |
|
|
|
|
# Package name of the derivation. |
|
|
|
|
pname ? "rust-custom", |
|
|
|
|
# Git revision of rustc. |
|
|
|
|
rev, |
|
|
|
|
# Attrset with component name as key and its SRI hash as value. |
|
|
|
|
components, |
|
|
|
|
# Rust target to download. |
|
|
|
|
target ? super.rust.toRustTarget self.stdenv.targetPlatform |
|
|
|
|
}: let |
|
|
|
|
shortRev = builtins.substring 0 7 rev; |
|
|
|
|
namesAndSrcs = super.lib.mapAttrsToList (component: hash: { |
|
|
|
|
name = "${component}-${shortRev}"; |
|
|
|
|
src = self.fetchurl { |
|
|
|
|
url = if component == "rust-src" |
|
|
|
|
then "https://ci-artifacts.rust-lang.org/rustc-builds/${rev}/${component}-nightly.tar.xz" |
|
|
|
|
else "https://ci-artifacts.rust-lang.org/rustc-builds/${rev}/${component}-nightly-${target}.tar.xz"; |
|
|
|
|
inherit hash; |
|
|
|
|
}; |
|
|
|
|
}) components; |
|
|
|
|
in |
|
|
|
|
aggregateComponents { |
|
|
|
|
version = shortRev; |
|
|
|
|
inherit pname namesAndSrcs; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
in { |
|
|
|
|
# For each channel: |
|
|
|
|
# rust-bin.stable.latest.cargo |
|
|
|
@ -362,6 +390,8 @@ in { |
|
|
|
|
mapAttrs (channel: mapAttrs (version: toolchainFromManifest)) super.rust-bin.manifests // |
|
|
|
|
{ |
|
|
|
|
inherit fromRustupToolchain fromRustupToolchainFile; |
|
|
|
|
# Experimental feature. |
|
|
|
|
inherit fromRustcRev; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# All attributes below are for compatiblity with mozilla overlay. |
|
|
|
|