Skip to content

Commit

Permalink
Prefer profiles for stable toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
oxalica committed Apr 6, 2021
1 parent e471233 commit 5f9d317
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 ];
})
];
};
Expand Down Expand Up @@ -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" ];
}
Expand Down
11 changes: 10 additions & 1 deletion rust-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5f9d317

Please sign in to comment.