Configure nightly toolchain in crane.nix

Get rid of this non-intuitive dependency of cranePkgs.cargoTargets.
This commit is contained in:
Zhaofeng Li 2023-05-22 16:00:34 -06:00
parent 2f25e613b2
commit e4c22456ef
2 changed files with 10 additions and 10 deletions

View file

@ -2,8 +2,8 @@
, pkgs
, lib
, crane
, rustNightly
, rust
, rust-bin
, nix-gitignore
, supportedSystems
}:
@ -11,6 +11,12 @@
let
inherit (stdenv.hostPlatform) system;
nightlyVersion = "2023-05-01";
rustNightly = pkgs.rust-bin.nightly.${nightlyVersion}.default.override {
extensions = [ "rust-src" "rust-analyzer-preview" ];
targets = cargoTargets;
};
# For easy cross-compilation in devShells
# We are just composing the pkgsCross.*.stdenv.cc together
crossPlatforms = let
@ -91,7 +97,7 @@ let
});
in crate;
in {
inherit crossPlatforms cargoTargets cargoCrossEnvs;
inherit crossPlatforms cargoTargets cargoCrossEnvs rustNightly;
nix-actions-cache = buildFor system;
}

View file

@ -26,7 +26,6 @@
outputs = { self, nixpkgs, flake-utils, rust-overlay, crane, ... }: let
supportedSystems = flake-utils.lib.defaultSystems;
nightlyVersion = "2023-05-01";
in flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {
inherit system;
@ -37,13 +36,8 @@
inherit (pkgs) lib;
rustNightly = pkgs.rust-bin.nightly.${nightlyVersion}.default.override {
extensions = [ "rust-src" "rust-analyzer-preview" ];
targets = cranePkgs.cargoTargets;
};
cranePkgs = pkgs.callPackage ./crane.nix {
inherit crane supportedSystems rustNightly;
inherit crane supportedSystems;
};
in {
packages = rec {
@ -55,7 +49,7 @@
inputsFrom = [ cranePkgs.nix-actions-cache ];
packages = with pkgs; [
bashInteractive
rustNightly
cranePkgs.rustNightly
cargo-bloat
cargo-edit