mirror of
https://github.com/oxalica/rust-overlay.git
synced 2025-10-05 15:52:54 +02:00
save
This commit is contained in:
@@ -4,16 +4,23 @@
|
||||
config = "x86_64-w64-mingw32";
|
||||
};
|
||||
overlays = [ (import ../..) ];
|
||||
}).callPackage (
|
||||
{ mkShell, stdenv, rust-bin, windows, wine64 }:
|
||||
mkShell {
|
||||
nativeBuildInputs = [
|
||||
rust-bin.stable.latest.minimal
|
||||
];
|
||||
}).callPackage
|
||||
(
|
||||
{
|
||||
mkShell,
|
||||
stdenv,
|
||||
rust-bin,
|
||||
windows,
|
||||
wine64,
|
||||
}:
|
||||
mkShell {
|
||||
nativeBuildInputs = [ rust-bin.stable.latest.minimal ];
|
||||
|
||||
depsBuildBuild = [ wine64 ];
|
||||
buildInputs = [ windows.pthreads ];
|
||||
depsBuildBuild = [ wine64 ];
|
||||
buildInputs = [ windows.pthreads ];
|
||||
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = "${stdenv.cc.targetPrefix}cc";
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = "wine64";
|
||||
}) {}
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = "${stdenv.cc.targetPrefix}cc";
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = "wine64";
|
||||
}
|
||||
)
|
||||
{ }
|
||||
|
@@ -6,17 +6,24 @@
|
||||
useLLVM = true;
|
||||
};
|
||||
overlays = [ (import ../..) ];
|
||||
}).callPackage (
|
||||
# We don't need WASI C compiler from nixpkgs, so use `mkShellNoCC`.
|
||||
{ mkShellNoCC, stdenv, rust-bin, wasmtime }:
|
||||
mkShellNoCC {
|
||||
nativeBuildInputs = [ rust-bin.stable.latest.minimal ];
|
||||
}).callPackage
|
||||
(
|
||||
# We don't need WASI C compiler from nixpkgs, so use `mkShellNoCC`.
|
||||
{
|
||||
mkShellNoCC,
|
||||
stdenv,
|
||||
rust-bin,
|
||||
wasmtime,
|
||||
}:
|
||||
mkShellNoCC {
|
||||
nativeBuildInputs = [ rust-bin.stable.latest.minimal ];
|
||||
|
||||
depsBuildBuild = [ wasmtime ];
|
||||
|
||||
# This is optional for wasm32-like targets, since rustc will automatically use
|
||||
# the bundled `lld` for linking.
|
||||
# CARGO_TARGET_WASM32_WASI_LINKER = "${stdenv.cc.targetPrefix}cc";
|
||||
CARGO_TARGET_WASM32_WASI_RUNNER = "wasmtime";
|
||||
}) {}
|
||||
depsBuildBuild = [ wasmtime ];
|
||||
|
||||
# This is optional for wasm32-like targets, since rustc will automatically use
|
||||
# the bundled `lld` for linking.
|
||||
# CARGO_TARGET_WASM32_WASI_LINKER = "${stdenv.cc.targetPrefix}cc";
|
||||
CARGO_TARGET_WASM32_WASI_RUNNER = "wasmtime";
|
||||
}
|
||||
)
|
||||
{ }
|
||||
|
149
flake.nix
149
flake.nix
@@ -8,84 +8,89 @@
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }@inputs: let
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (lib) filterAttrs mapAttrs' replaceStrings;
|
||||
outputs =
|
||||
{ self, nixpkgs }@inputs:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (lib) filterAttrs mapAttrs' replaceStrings;
|
||||
|
||||
forEachSystem = lib.genAttrs lib.systems.flakeExposed;
|
||||
forEachSystem = lib.genAttrs lib.systems.flakeExposed;
|
||||
|
||||
overlay = import ./.;
|
||||
overlay = import ./.;
|
||||
|
||||
defaultDistRoot = import ./lib/dist-root.nix;
|
||||
mkManifests = distRoot: import ./lib/manifests.nix { inherit lib distRoot; };
|
||||
defaultDistRoot = import ./lib/dist-root.nix;
|
||||
mkManifests = distRoot: import ./lib/manifests.nix { inherit lib distRoot; };
|
||||
|
||||
# Builder to construct `rust-bin` interface on an existing `pkgs`.
|
||||
# This would be immutable, non-intrusive and (hopefully) can benefit from
|
||||
# flake eval-cache.
|
||||
#
|
||||
# Note that this does not contain compatible attrs for mozilla-overlay.
|
||||
mkRustBin =
|
||||
{ distRoot ? defaultDistRoot }:
|
||||
pkgs:
|
||||
lib.fix (rust-bin: import ./lib/rust-bin.nix {
|
||||
inherit lib pkgs;
|
||||
inherit (pkgs.rust) toRustTarget;
|
||||
inherit (rust-bin) nightly;
|
||||
manifests = mkManifests distRoot;
|
||||
});
|
||||
# Builder to construct `rust-bin` interface on an existing `pkgs`.
|
||||
# This would be immutable, non-intrusive and (hopefully) can benefit from
|
||||
# flake eval-cache.
|
||||
#
|
||||
# Note that this does not contain compatible attrs for mozilla-overlay.
|
||||
mkRustBin =
|
||||
{
|
||||
distRoot ? defaultDistRoot,
|
||||
}:
|
||||
pkgs:
|
||||
lib.fix (
|
||||
rust-bin:
|
||||
import ./lib/rust-bin.nix {
|
||||
inherit lib pkgs;
|
||||
inherit (pkgs.rust) toRustTarget;
|
||||
inherit (rust-bin) nightly;
|
||||
manifests = mkManifests distRoot;
|
||||
}
|
||||
);
|
||||
|
||||
in {
|
||||
lib = {
|
||||
# Internal use only!
|
||||
_internal = {
|
||||
defaultManifests = mkManifests defaultDistRoot;
|
||||
in
|
||||
{
|
||||
lib = {
|
||||
# Internal use only!
|
||||
_internal = {
|
||||
defaultManifests = mkManifests defaultDistRoot;
|
||||
};
|
||||
|
||||
inherit mkRustBin;
|
||||
};
|
||||
|
||||
inherit mkRustBin;
|
||||
overlays = {
|
||||
default = overlay;
|
||||
rust-overlay = overlay;
|
||||
};
|
||||
|
||||
# TODO: Flake outputs except `overlay[s]` are not stabilized yet.
|
||||
|
||||
packages =
|
||||
let
|
||||
select =
|
||||
version: comps:
|
||||
if comps ? default then
|
||||
comps.default // { minimal = comps.minimal or (throw "missing profile 'minimal' for ${version}"); }
|
||||
else
|
||||
null;
|
||||
result =
|
||||
rust-bin:
|
||||
mapAttrs' (version: comps: {
|
||||
name = if version == "latest" then "rust" else "rust_${replaceStrings [ "." ] [ "_" ] version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.stable
|
||||
// mapAttrs' (version: comps: {
|
||||
name = if version == "latest" then "rust-nightly" else "rust-nightly_${version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.nightly
|
||||
// mapAttrs' (version: comps: {
|
||||
name = if version == "latest" then "rust-beta" else "rust-beta_${version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.beta;
|
||||
result' = rust-bin: filterAttrs (name: drv: drv != null) (result rust-bin);
|
||||
in
|
||||
forEachSystem (
|
||||
system:
|
||||
result' (mkRustBin { } nixpkgs.legacyPackages.${system})
|
||||
// {
|
||||
default = self.packages.${system}.rust;
|
||||
}
|
||||
);
|
||||
|
||||
checks = forEachSystem (import ./tests inputs);
|
||||
};
|
||||
|
||||
overlays = {
|
||||
default = overlay;
|
||||
rust-overlay = overlay;
|
||||
};
|
||||
|
||||
# TODO: Flake outputs except `overlay[s]` are not stabilized yet.
|
||||
|
||||
packages =
|
||||
let
|
||||
select = version: comps:
|
||||
if comps ? default then
|
||||
comps.default // {
|
||||
minimal = comps.minimal or (throw "missing profile 'minimal' for ${version}");
|
||||
}
|
||||
else
|
||||
null;
|
||||
result = rust-bin:
|
||||
mapAttrs' (version: comps: {
|
||||
name = if version == "latest"
|
||||
then "rust"
|
||||
else "rust_${replaceStrings ["."] ["_"] version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.stable //
|
||||
mapAttrs' (version: comps: {
|
||||
name = if version == "latest"
|
||||
then "rust-nightly"
|
||||
else "rust-nightly_${version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.nightly //
|
||||
mapAttrs' (version: comps: {
|
||||
name = if version == "latest"
|
||||
then "rust-beta"
|
||||
else "rust-beta_${version}";
|
||||
value = select version comps;
|
||||
}) rust-bin.beta;
|
||||
result' = rust-bin: filterAttrs (name: drv: drv != null) (result rust-bin);
|
||||
in
|
||||
forEachSystem (system:
|
||||
result' (mkRustBin {} nixpkgs.legacyPackages.${system})
|
||||
// { default = self.packages.${system}.rust; }
|
||||
);
|
||||
|
||||
checks = forEachSystem (import ./tests inputs);
|
||||
};
|
||||
}
|
||||
|
@@ -41,17 +41,20 @@ let
|
||||
"rustc-docs"
|
||||
"rust-src" # This has only one special target `*`
|
||||
];
|
||||
rustPkgExtra = pkgs: target: let
|
||||
singleTargetTups = map
|
||||
(pkg: { inherit pkg target; })
|
||||
(filter (p: hasAttr p pkgs && hasAttr target pkgs.${p}.target) singleTargetExtensions);
|
||||
multiTargetTups = concatMap
|
||||
(pkg: map (target: { inherit pkg target; }) (attrNames pkgs.${pkg}.target))
|
||||
(filter (p: hasAttr p pkgs) multiTargetExtensions);
|
||||
in {
|
||||
components = map (pkg: { inherit pkg target; }) components;
|
||||
extensions = singleTargetTups ++ multiTargetTups;
|
||||
};
|
||||
rustPkgExtra =
|
||||
pkgs: target:
|
||||
let
|
||||
singleTargetTups = map (pkg: { inherit pkg target; }) (
|
||||
filter (p: hasAttr p pkgs && hasAttr target pkgs.${p}.target) singleTargetExtensions
|
||||
);
|
||||
multiTargetTups = concatMap (
|
||||
pkg: map (target: { inherit pkg target; }) (attrNames pkgs.${pkg}.target)
|
||||
) (filter (p: hasAttr p pkgs) multiTargetExtensions);
|
||||
in
|
||||
{
|
||||
components = map (pkg: { inherit pkg target; }) components;
|
||||
extensions = singleTargetTups ++ multiTargetTups;
|
||||
};
|
||||
|
||||
# Uncompress the compressed manifest to the original one
|
||||
# (not complete but has enough information to make up the toolchain).
|
||||
@@ -76,37 +79,62 @@ let
|
||||
date = d;
|
||||
renames = mapAttrs (from: to: { inherit to; }) (elemAt renamesList r);
|
||||
|
||||
pkg =
|
||||
mapAttrs (pkgName: { u ? null /* Version appears in URL */, ... }@hashes: {
|
||||
# We use rustc version for all components to reduce manifest size.
|
||||
# This version is just used for component derivation name.
|
||||
version = "${v} (000000000 ${d})"; # "<version> (<commit-hash> yyyy-mm-dd)"
|
||||
target = let
|
||||
results = mapAttrs' (targetIdx: hash: let
|
||||
target = targets.${targetIdx};
|
||||
pkgNameStripped = removeSuffix "-preview" pkgName;
|
||||
targetTail = if targetIdx == "_" then "" else "-" + target;
|
||||
urlVersion =
|
||||
if u != null then u # Use specified version for URL if exists.
|
||||
else if channel == "stable" then v # For stable channel, default to be rustc version.
|
||||
else channel; # Otherwise, for beta/nightly channel, default to be "beta"/"nightly".
|
||||
in {
|
||||
name = target;
|
||||
value =
|
||||
# Normally, hash is just the hash.
|
||||
if isString hash then
|
||||
{
|
||||
xz_url = "${distRoot}/${date}/${pkgNameStripped}-${urlVersion}${targetTail}.tar.xz";
|
||||
xz_hash = hash;
|
||||
} // (if pkgName == "rust" then rustPkgExtra pkg target else {})
|
||||
# But hash can be an integer to forward to another URL.
|
||||
# This occurs in aarch64-apple-darwin rust-docs on 2022-02-02.
|
||||
else
|
||||
results.${targets."_${toString hash}"};
|
||||
}) (removeAttrs hashes ["u"]);
|
||||
in
|
||||
results;
|
||||
}) (removeAttrs manifest ["v" "d" "r" "p"]);
|
||||
pkg =
|
||||
mapAttrs
|
||||
(
|
||||
pkgName:
|
||||
{
|
||||
u ? null, # Version appears in URL
|
||||
...
|
||||
}@hashes:
|
||||
{
|
||||
# We use rustc version for all components to reduce manifest size.
|
||||
# This version is just used for component derivation name.
|
||||
version = "${v} (000000000 ${d})"; # "<version> (<commit-hash> yyyy-mm-dd)"
|
||||
target =
|
||||
let
|
||||
results = mapAttrs' (
|
||||
targetIdx: hash:
|
||||
let
|
||||
target = targets.${targetIdx};
|
||||
pkgNameStripped = removeSuffix "-preview" pkgName;
|
||||
targetTail = if targetIdx == "_" then "" else "-" + target;
|
||||
urlVersion =
|
||||
if u != null then
|
||||
u # Use specified version for URL if exists.
|
||||
else if channel == "stable" then
|
||||
v # For stable channel, default to be rustc version.
|
||||
else
|
||||
channel; # Otherwise, for beta/nightly channel, default to be "beta"/"nightly".
|
||||
in
|
||||
{
|
||||
name = target;
|
||||
value =
|
||||
# Normally, hash is just the hash.
|
||||
if isString hash then
|
||||
{
|
||||
xz_url = "${distRoot}/${date}/${pkgNameStripped}-${urlVersion}${targetTail}.tar.xz";
|
||||
xz_hash = hash;
|
||||
}
|
||||
// (if pkgName == "rust" then rustPkgExtra pkg target else { })
|
||||
# But hash can be an integer to forward to another URL.
|
||||
# This occurs in aarch64-apple-darwin rust-docs on 2022-02-02.
|
||||
else
|
||||
results.${targets."_${toString hash}"};
|
||||
}
|
||||
) (removeAttrs hashes [ "u" ]);
|
||||
in
|
||||
results;
|
||||
}
|
||||
)
|
||||
(
|
||||
removeAttrs manifest [
|
||||
"v"
|
||||
"d"
|
||||
"r"
|
||||
"p"
|
||||
]
|
||||
);
|
||||
|
||||
profiles = if p == null then { } else elemAt profilesList p;
|
||||
|
||||
|
@@ -129,43 +129,50 @@ let
|
||||
];
|
||||
|
||||
# Darwin binaries usually just work... except for these linking to rustc from another drv.
|
||||
postFixup = optionalString (hostPlatform.isDarwin && linksToRustc) ''
|
||||
for f in $out/bin/*; do
|
||||
install_name_tool -add_rpath "${self.rustc}/lib" "$f" || true
|
||||
done
|
||||
''
|
||||
# Wrap the shipped `rust-lld` (lld), which is used by default on some targets.
|
||||
# Unfortunately there is no hook to conveniently wrap CC tools inside
|
||||
# derivation and `wrapBintools` is designed for wrapping a standalone
|
||||
# bintools derivation. We hereby copy minimal of their implementation.
|
||||
# The `wrap()` is from:
|
||||
# https://github.com/NixOS/nixpkgs/blob/bfb7a882678e518398ce9a31a881538679f6f092/pkgs/build-support/bintools-wrapper/default.nix#L178
|
||||
+ optionalString (pname == "rustc") ''
|
||||
wrap() {
|
||||
local dst="$1"
|
||||
local wrapper="$2"
|
||||
export prog="$3"
|
||||
export use_response_file_by_default=0
|
||||
substituteAll "$wrapper" "$dst"
|
||||
chmod +x "$dst"
|
||||
}
|
||||
|
||||
dsts=( "$out"/lib/rustlib/*/bin/gcc-ld/ld.lld )
|
||||
if [[ ''${#dsts} -ne 0 ]]; then
|
||||
mkdir -p $out/nix-support
|
||||
substituteAll ${path + "/pkgs/build-support/wrapper-common/utils.bash"} $out/nix-support/utils.bash
|
||||
substituteAll ${path + "/pkgs/build-support/bintools-wrapper/add-flags.sh"} $out/nix-support/add-flags.sh
|
||||
substituteAll ${path + "/pkgs/build-support/bintools-wrapper/add-hardening.sh"} $out/nix-support/add-hardening.sh
|
||||
|
||||
for dst in "''${dsts[@]}"; do
|
||||
# The ld.lld is path/name sensitive because itself is a wrapper. Keep its original name.
|
||||
unwrapped="$(dirname "$dst")-unwrapped/ld.lld"
|
||||
mkdir -p "$(dirname "$unwrapped")"
|
||||
mv "$dst" "$unwrapped"
|
||||
wrap "$dst" ${path + "/pkgs/build-support/bintools-wrapper/ld-wrapper.sh"} "$unwrapped"
|
||||
postFixup =
|
||||
optionalString (hostPlatform.isDarwin && linksToRustc) ''
|
||||
for f in $out/bin/*; do
|
||||
install_name_tool -add_rpath "${self.rustc}/lib" "$f" || true
|
||||
done
|
||||
fi
|
||||
'';
|
||||
''
|
||||
# Wrap the shipped `rust-lld` (lld), which is used by default on some targets.
|
||||
# Unfortunately there is no hook to conveniently wrap CC tools inside
|
||||
# derivation and `wrapBintools` is designed for wrapping a standalone
|
||||
# bintools derivation. We hereby copy minimal of their implementation.
|
||||
# The `wrap()` is from:
|
||||
# https://github.com/NixOS/nixpkgs/blob/bfb7a882678e518398ce9a31a881538679f6f092/pkgs/build-support/bintools-wrapper/default.nix#L178
|
||||
+ optionalString (pname == "rustc") ''
|
||||
wrap() {
|
||||
local dst="$1"
|
||||
local wrapper="$2"
|
||||
export prog="$3"
|
||||
export use_response_file_by_default=0
|
||||
substituteAll "$wrapper" "$dst"
|
||||
chmod +x "$dst"
|
||||
}
|
||||
|
||||
dsts=( "$out"/lib/rustlib/*/bin/gcc-ld/ld.lld )
|
||||
if [[ ''${#dsts} -ne 0 ]]; then
|
||||
mkdir -p $out/nix-support
|
||||
substituteAll ${
|
||||
path + "/pkgs/build-support/wrapper-common/utils.bash"
|
||||
} $out/nix-support/utils.bash
|
||||
substituteAll ${
|
||||
path + "/pkgs/build-support/bintools-wrapper/add-flags.sh"
|
||||
} $out/nix-support/add-flags.sh
|
||||
substituteAll ${
|
||||
path + "/pkgs/build-support/bintools-wrapper/add-hardening.sh"
|
||||
} $out/nix-support/add-hardening.sh
|
||||
|
||||
for dst in "''${dsts[@]}"; do
|
||||
# The ld.lld is path/name sensitive because itself is a wrapper. Keep its original name.
|
||||
unwrapped="$(dirname "$dst")-unwrapped/ld.lld"
|
||||
mkdir -p "$(dirname "$unwrapped")"
|
||||
mv "$dst" "$unwrapped"
|
||||
wrap "$dst" ${path + "/pkgs/build-support/bintools-wrapper/ld-wrapper.sh"} "$unwrapped"
|
||||
done
|
||||
fi
|
||||
'';
|
||||
|
||||
env = lib.optionalAttrs (pname == "rustc") {
|
||||
inherit (stdenv.cc.bintools)
|
||||
|
145
lib/rust-bin.nix
145
lib/rust-bin.nix
@@ -338,26 +338,31 @@ let
|
||||
# All extensions in this list will be installed for the target architectures.
|
||||
# *Attention* If you want to install an extension like rust-src, that has no fixed architecture (arch *),
|
||||
# you will need to specify this extension in the extensions options or it will not be installed!
|
||||
toolchainFromManifest = manifest: let
|
||||
# platform -> true
|
||||
# For fail-fast test.
|
||||
allPlatformSet =
|
||||
listToAttrs (
|
||||
toolchainFromManifest =
|
||||
manifest:
|
||||
let
|
||||
# platform -> true
|
||||
# For fail-fast test.
|
||||
allPlatformSet = listToAttrs (
|
||||
flatten (
|
||||
mapAttrsToList (compName: { target, ... }:
|
||||
map (platform: { name = platform; value = true; })
|
||||
(attrNames target)
|
||||
) manifest.pkg));
|
||||
mapAttrsToList (
|
||||
compName:
|
||||
{ target, ... }:
|
||||
map (platform: {
|
||||
name = platform;
|
||||
value = true;
|
||||
}) (attrNames target)
|
||||
) manifest.pkg
|
||||
)
|
||||
);
|
||||
|
||||
# componentName -> true
|
||||
# May also contains unavailable components. Just for fail-fast test.
|
||||
allComponentSet =
|
||||
mapAttrs (compName: _: true)
|
||||
(manifest.pkg // manifest.renames);
|
||||
# componentName -> true
|
||||
# May also contains unavailable components. Just for fail-fast test.
|
||||
allComponentSet = mapAttrs (compName: _: true) (manifest.pkg // manifest.renames);
|
||||
|
||||
# componentSet.x86_64-unknown-linux-gnu.cargo = <derivation>;
|
||||
componentSet =
|
||||
mapAttrs (platform: _:
|
||||
# componentSet.x86_64-unknown-linux-gnu.cargo = <derivation>;
|
||||
componentSet = mapAttrs (
|
||||
platform: _:
|
||||
mkComponentSet {
|
||||
inherit (manifest) version renames;
|
||||
inherit platform;
|
||||
@@ -380,53 +385,73 @@ let
|
||||
}
|
||||
) allPlatformSet;
|
||||
|
||||
mkProfile = name: profileComponents:
|
||||
makeOverridable ({ extensions, targets, targetExtensions }:
|
||||
mkAggregated {
|
||||
pname = "rust-${name}";
|
||||
inherit (manifest) version date;
|
||||
availableComponents = componentSet.${rustHostPlatform};
|
||||
selectedComponents = resolveComponents {
|
||||
name = "rust-${name}-${manifest.version}";
|
||||
inherit allPlatformSet allComponentSet componentSet profileComponents targetExtensions;
|
||||
inherit (manifest) targetComponentsList;
|
||||
extensions = extensions;
|
||||
targets = unique ([
|
||||
rustHostPlatform # Build script requires host std.
|
||||
rustTargetPlatform
|
||||
] ++ targets);
|
||||
mkProfile =
|
||||
name: profileComponents:
|
||||
makeOverridable
|
||||
(
|
||||
{
|
||||
extensions,
|
||||
targets,
|
||||
targetExtensions,
|
||||
}:
|
||||
mkAggregated {
|
||||
pname = "rust-${name}";
|
||||
inherit (manifest) version date;
|
||||
availableComponents = componentSet.${rustHostPlatform};
|
||||
selectedComponents = resolveComponents {
|
||||
name = "rust-${name}-${manifest.version}";
|
||||
inherit
|
||||
allPlatformSet
|
||||
allComponentSet
|
||||
componentSet
|
||||
profileComponents
|
||||
targetExtensions
|
||||
;
|
||||
inherit (manifest) targetComponentsList;
|
||||
extensions = extensions;
|
||||
targets = unique (
|
||||
[
|
||||
rustHostPlatform # Build script requires host std.
|
||||
rustTargetPlatform
|
||||
]
|
||||
++ targets
|
||||
);
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
extensions = [ ];
|
||||
targets = [ ];
|
||||
targetExtensions = [ ];
|
||||
};
|
||||
}
|
||||
) {
|
||||
extensions = [];
|
||||
targets = [];
|
||||
targetExtensions = [];
|
||||
};
|
||||
|
||||
profiles = mapAttrs mkProfile manifest.profiles;
|
||||
profiles = mapAttrs mkProfile manifest.profiles;
|
||||
|
||||
result =
|
||||
# Individual components.
|
||||
componentSet.${rustHostPlatform} //
|
||||
# Profiles.
|
||||
profiles // {
|
||||
# Legacy support for special pre-aggregated package.
|
||||
# It has more components than `default` profile but less than `complete` profile.
|
||||
rust =
|
||||
let
|
||||
pkg = mkProfile "legacy" [ "rust" ];
|
||||
in if profiles != {} then
|
||||
trace ''
|
||||
Rust ${manifest.version}:
|
||||
Pre-aggregated package `rust` is not encouraged for stable channel since it contains almost all and uncertain components.
|
||||
Consider use `default` profile like `rust-bin.stable.latest.default` and override it with extensions you need.
|
||||
See README for more information.
|
||||
'' pkg
|
||||
else
|
||||
pkg;
|
||||
};
|
||||
result =
|
||||
# Individual components.
|
||||
componentSet.${rustHostPlatform}
|
||||
//
|
||||
# Profiles.
|
||||
profiles
|
||||
// {
|
||||
# Legacy support for special pre-aggregated package.
|
||||
# It has more components than `default` profile but less than `complete` profile.
|
||||
rust =
|
||||
let
|
||||
pkg = mkProfile "legacy" [ "rust" ];
|
||||
in
|
||||
if profiles != { } then
|
||||
trace ''
|
||||
Rust ${manifest.version}:
|
||||
Pre-aggregated package `rust` is not encouraged for stable channel since it contains almost all and uncertain components.
|
||||
Consider use `default` profile like `rust-bin.stable.latest.default` and override it with extensions you need.
|
||||
See README for more information.
|
||||
'' pkg
|
||||
else
|
||||
pkg;
|
||||
};
|
||||
|
||||
in
|
||||
in
|
||||
# If the platform is not supported for the current version, return nothing here,
|
||||
# so others can easily check it by `toolchain ? default`.
|
||||
optionalAttrs (componentSet ? ${rustHostPlatform}) result
|
||||
|
@@ -87,57 +87,106 @@ optionalAttrs
|
||||
latest-beta-legacy = assertEq latest.rustChannels.beta.rustc beta.latest.rustc;
|
||||
latest-nightly-legacy = assertEq latest.rustChannels.nightly.rustc nightly.latest.rustc;
|
||||
|
||||
rust-channel-of-stable = assertEq (rustChannelOf { channel = "stable"; }).rustc stable.latest.rustc;
|
||||
rust-channel-of-beta = assertEq (rustChannelOf { channel = "beta"; }).rustc beta.latest.rustc;
|
||||
rust-channel-of-nightly = assertEq (rustChannelOf { channel = "nightly"; }).rustc nightly.latest.rustc;
|
||||
rust-channel-of-version = assertEq (rustChannelOf { channel = "1.48.0"; }).rustc stable."1.48.0".rustc;
|
||||
rust-channel-of-nightly-date = assertEq (rustChannelOf { channel = "nightly"; date = "2021-01-01"; }).rustc nightly."2021-01-01".rustc;
|
||||
rust-channel-of-beta-date = assertEq (rustChannelOf { channel = "beta"; date = "2021-01-01"; }).rustc beta."2021-01-01".rustc;
|
||||
rust-channel-of-stable = assertEq (rustChannelOf { channel = "stable"; }).rustc stable.latest.rustc;
|
||||
rust-channel-of-beta = assertEq (rustChannelOf { channel = "beta"; }).rustc beta.latest.rustc;
|
||||
rust-channel-of-nightly = assertEq (rustChannelOf { channel = "nightly"; })
|
||||
.rustc nightly.latest.rustc;
|
||||
rust-channel-of-version = assertEq (rustChannelOf { channel = "1.48.0"; })
|
||||
.rustc stable."1.48.0".rustc;
|
||||
rust-channel-of-nightly-date = assertEq (rustChannelOf {
|
||||
channel = "nightly";
|
||||
date = "2021-01-01";
|
||||
}).rustc nightly."2021-01-01".rustc;
|
||||
rust-channel-of-beta-date = assertEq (rustChannelOf {
|
||||
channel = "beta";
|
||||
date = "2021-01-01";
|
||||
}).rustc beta."2021-01-01".rustc;
|
||||
|
||||
rustup-toolchain-stable = assertEq (fromRustupToolchain { channel = "stable"; }) stable.latest.default;
|
||||
rustup-toolchain-beta = assertEq (fromRustupToolchain { channel = "beta"; }) beta.latest.default;
|
||||
# rustup-toolchain-nightly = assertEq (fromRustupToolchain { channel = "nightly"; }) nightly.latest.default; # Not always available
|
||||
rustup-toolchain-version = assertEq (fromRustupToolchain { channel = "1.51.0"; }) stable."1.51.0".default;
|
||||
rustup-toolchain-nightly-date = assertEq (fromRustupToolchain { channel = "nightly-2021-01-01"; }) nightly."2021-01-01".default;
|
||||
rustup-toolchain-beta-date = assertEq (fromRustupToolchain { channel = "beta-2021-01-01"; }) beta."2021-01-01".default;
|
||||
rustup-toolchain-customization = assertEq
|
||||
(fromRustupToolchain {
|
||||
rustup-toolchain-stable = assertEq (fromRustupToolchain {
|
||||
channel = "stable";
|
||||
}) stable.latest.default;
|
||||
rustup-toolchain-beta = assertEq (fromRustupToolchain { channel = "beta"; }) beta.latest.default;
|
||||
# rustup-toolchain-nightly = assertEq (fromRustupToolchain { channel = "nightly"; }) nightly.latest.default; # Not always available
|
||||
rustup-toolchain-version = assertEq (fromRustupToolchain {
|
||||
channel = "1.51.0";
|
||||
components = [ "rustfmt" "rustc-dev" ];
|
||||
targets = [ "wasm32-unknown-unknown" "aarch64-unknown-linux-gnu" ];
|
||||
})
|
||||
(stable."1.51.0".default.override {
|
||||
extensions = [ "rustfmt" "rustc-dev" ];
|
||||
targets = [ "wasm32-unknown-unknown" "aarch64-unknown-linux-gnu" ];
|
||||
});
|
||||
}) stable."1.51.0".default;
|
||||
rustup-toolchain-nightly-date = assertEq (fromRustupToolchain {
|
||||
channel = "nightly-2021-01-01";
|
||||
}) nightly."2021-01-01".default;
|
||||
rustup-toolchain-beta-date = assertEq (fromRustupToolchain {
|
||||
channel = "beta-2021-01-01";
|
||||
}) beta."2021-01-01".default;
|
||||
rustup-toolchain-customization =
|
||||
assertEq
|
||||
(fromRustupToolchain {
|
||||
channel = "1.51.0";
|
||||
components = [
|
||||
"rustfmt"
|
||||
"rustc-dev"
|
||||
];
|
||||
targets = [
|
||||
"wasm32-unknown-unknown"
|
||||
"aarch64-unknown-linux-gnu"
|
||||
];
|
||||
})
|
||||
(
|
||||
stable."1.51.0".default.override {
|
||||
extensions = [
|
||||
"rustfmt"
|
||||
"rustc-dev"
|
||||
];
|
||||
targets = [
|
||||
"wasm32-unknown-unknown"
|
||||
"aarch64-unknown-linux-gnu"
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
rustup-toolchain-profile-missing = assertEq (builtins.tryEval (fromRustupToolchain { channel = "1.51.0"; profile = "non_existent"; })).success false;
|
||||
rustup-toolchain-profile-too-early = assertEq (builtins.tryEval (fromRustupToolchain { channel = "1.29.0"; profile = "minimal"; })).success false;
|
||||
rustup-toolchain-profile-fallback = assertEq (fromRustupToolchain { channel = "1.29.0"; }) stable."1.29.0".rust;
|
||||
rustup-toolchain-profile-missing = assertEq (builtins.tryEval (fromRustupToolchain {
|
||||
channel = "1.51.0";
|
||||
profile = "non_existent";
|
||||
})).success false;
|
||||
rustup-toolchain-profile-too-early = assertEq (builtins.tryEval (fromRustupToolchain {
|
||||
channel = "1.29.0";
|
||||
profile = "minimal";
|
||||
})).success false;
|
||||
rustup-toolchain-profile-fallback = assertEq (fromRustupToolchain {
|
||||
channel = "1.29.0";
|
||||
}) stable."1.29.0".rust;
|
||||
|
||||
rustup-toolchain-file-toml = assertEq
|
||||
(fromRustupToolchainFile ./rust-toolchain-toml)
|
||||
(nightly."2021-03-25".default.override {
|
||||
extensions = [ "rustfmt" "rustc-dev" ];
|
||||
targets = [ "wasm32-unknown-unknown" "aarch64-unknown-linux-gnu" ];
|
||||
});
|
||||
rustup-toolchain-file-legacy = assertEq
|
||||
(fromRustupToolchainFile ./rust-toolchain-legacy)
|
||||
nightly."2021-03-25".default;
|
||||
rustup-toolchain-file-minimal = assertEq
|
||||
(fromRustupToolchainFile ./rust-toolchain-minimal)
|
||||
(nightly."2021-03-25".minimal.override {
|
||||
extensions = [ "rustfmt" "rustc-dev" ];
|
||||
targets = [ "aarch64-unknown-linux-gnu" ];
|
||||
});
|
||||
rustup-toolchain-file-toml = assertEq (fromRustupToolchainFile ./rust-toolchain-toml) (
|
||||
nightly."2021-03-25".default.override {
|
||||
extensions = [
|
||||
"rustfmt"
|
||||
"rustc-dev"
|
||||
];
|
||||
targets = [
|
||||
"wasm32-unknown-unknown"
|
||||
"aarch64-unknown-linux-gnu"
|
||||
];
|
||||
}
|
||||
);
|
||||
rustup-toolchain-file-legacy =
|
||||
assertEq (fromRustupToolchainFile ./rust-toolchain-legacy)
|
||||
nightly."2021-03-25".default;
|
||||
rustup-toolchain-file-minimal = assertEq (fromRustupToolchainFile ./rust-toolchain-minimal) (
|
||||
nightly."2021-03-25".minimal.override {
|
||||
extensions = [
|
||||
"rustfmt"
|
||||
"rustc-dev"
|
||||
];
|
||||
targets = [ "aarch64-unknown-linux-gnu" ];
|
||||
}
|
||||
);
|
||||
|
||||
latest-nightly-default = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
|
||||
latest-nightly-default = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
|
||||
|
||||
# Darwin specific tests.
|
||||
} // optionalAttrs (system == "aarch64-darwin") {
|
||||
url-forward = assertUrl
|
||||
nightly."2022-02-02".rust-docs
|
||||
"https://static.rust-lang.org/dist/2022-02-02/rust-docs-nightly-x86_64-apple-darwin.tar.xz";
|
||||
# Darwin specific tests.
|
||||
}
|
||||
// optionalAttrs (system == "aarch64-darwin") {
|
||||
url-forward =
|
||||
assertUrl nightly."2022-02-02".rust-docs
|
||||
"https://static.rust-lang.org/dist/2022-02-02/rust-docs-nightly-x86_64-apple-darwin.tar.xz";
|
||||
aarch64-darwin-use-x86-docs = rust-bin.stable."1.51.0".default.override {
|
||||
targets = [ "x86_64-apple-darwin" ];
|
||||
targetExtensions = [ "rust-docs" ];
|
||||
|
Reference in New Issue
Block a user