diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index 6dfc8a49063f..82579db0e47a 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -77,6 +77,7 @@ in pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; }; }); rustfmt = self.callPackage ./rustfmt.nix { inherit Security; }; + rustfmt-nightly = self.callPackage ./rustfmt.nix { inherit Security; asNightly = true; }; cargo = self.callPackage ./cargo.nix { # Use boot package set to break cycle rustPlatform = bootRustPlatform; diff --git a/pkgs/development/compilers/rust/rustfmt.nix b/pkgs/development/compilers/rust/rustfmt.nix index 9922d60ef705..5916b6c07fb5 100644 --- a/pkgs/development/compilers/rust/rustfmt.nix +++ b/pkgs/development/compilers/rust/rustfmt.nix @@ -1,7 +1,7 @@ -{ lib, stdenv, rustPlatform, Security }: +{ lib, stdenv, rustPlatform, Security, asNightly ? false }: rustPlatform.buildRustPackage rec { - pname = "rustfmt"; + pname = "rustfmt" + lib.optionalString asNightly "-nightly"; inherit (rustPlatform.rust.rustc) version src; # the rust source tarball already has all the dependencies vendored, no need to fetch them again @@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec { # As of rustc 1.45.0, these env vars are required to build rustfmt (due to # https://github.com/rust-lang/rust/pull/72001) CFG_RELEASE = rustPlatform.rust.rustc.version; - CFG_RELEASE_CHANNEL = "stable"; + CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable"; # FIXME: seems fixed upstream, remove after the next update patches = [ ./rustfmt-fix-self-tests.patch ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 227cdccaec1f..851c26182130 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13471,7 +13471,10 @@ with pkgs; rhack = callPackage ../development/tools/rust/rhack { }; inherit (rustPackages) rls; roogle = callPackage ../development/tools/rust/roogle { }; + rustfmt = rustPackages.rustfmt; + rustfmt-nightly = rustPackages.rustfmt-nightly; + rustracer = callPackage ../development/tools/rust/racer { inherit (darwin.apple_sdk.frameworks) Security; };