From 5f9d317ebb70a3f47c9f9eedc7e55af93b3b4481 Mon Sep 17 00:00:00 2001 From: oxalica Date: Tue, 6 Apr 2021 01:38:31 +0800 Subject: [PATCH] Prefer profiles for stable toolchains --- README.md | 14 ++++++-------- rust-overlay.nix | 11 ++++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ffe2c2a0f05..de95aca185e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ You can put the code below into your `~/.config/nixpkgs/overlays.nix`. ``` Then the provided attribute paths are available in nix command. ```bash -$ nix-env -iA rust-bin.stable.latest.rust # Do anything you like. +$ nix-env -iA rust-bin.stable.latest.default # Do anything you like. ``` Alternatively, you can install it into nix channels. @@ -68,7 +68,7 @@ Here's an example of using it in nixos configuration. ./configuration.nix # Your system configuration. ({ pkgs, ... }: { nixpkgs.overlays = [ rust-overlay.overlay ]; - environment.systemPackages = [ pkgs.rust-bin.stable.latest.rust ]; + environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ]; }) ]; }; @@ -164,18 +164,16 @@ Some examples (assume `nixpkgs` had the overlay applied): You can check availability on [Rustup packages availibility](https://rust-lang.github.io/rustup-components-history/). - A specific version of stable rust: - `nixpkgs.rust-bin.stable."1.48.0".rust` + `nixpkgs.rust-bin.stable."1.48.0".default` - A specific date of beta rust: - `nixpkgs.rust-bin.nightly."2021-01-01".rust` -- A specific version of stable rust: - `nixpkgs.rust-bin.stable."1.48.0".rust` + `nixpkgs.rust-bin.beta."2021-01-01".default` - A specific date of nightly rust: - `nixpkgs.rust-bin.nightly."2020-12-31".rust` + `nixpkgs.rust-bin.nightly."2020-12-31".default` - Latest stable rust with additional component `rust-src` and extra target `arm-unknown-linux-gnueabihf`: ```nix - nixpkgs.rust-bin.stable.latest.rust.override { + nixpkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; targets = [ "arm-unknown-linux-gnueabihf" ]; } diff --git a/rust-overlay.nix b/rust-overlay.nix index b563923b544..98a179121f9 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -454,7 +454,16 @@ let { # Legacy support for special pre-aggregated package. # It has more components than `default` profile but less than `complete` profile. - rust = mkPackage "rust" manifest.pkg.rust; + rust = + let pkg = mkPackage "rust" manifest.pkg.rust; in + if builtins.match ".*[.].*[.].*" != null + then builtins.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; # Internal use. _components = componentSet;