fix(rust): use proper withComponents toolchain
Using this function properly links the `rustup` components together, allowing e.g. `rust-analyzer` to find the location of `rust-src`.
This commit is contained in:
parent
5ea809eaa0
commit
306981fd2a
5 changed files with 30 additions and 10 deletions
|
|
@ -16,7 +16,7 @@
|
|||
packages = eachSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
|
||||
toolchain = import ./toolchain.nix fenix.packages.${system} "build";
|
||||
in {
|
||||
hello = pkgs.callPackage ./package.nix {
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
checks = eachSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
|
||||
toolchain = import ./toolchain.nix fenix.packages.${system} "check";
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
crate = self.packages.${system}.default;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
{ pkgs ? import <nixpkgs> {},
|
||||
crane ? builtins.getFlake "github:ipetkov/crane",
|
||||
fenix ? builtins.getFlake "github:nix-community/fenix",
|
||||
fenixToolchain ? "default"
|
||||
}:
|
||||
let
|
||||
fenixPkgs = fenix.packages.${pkgs.system};
|
||||
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
|
||||
toolchain = import ./toolchain.nix fenix.packages.${pkgs.stdenv.hostPlatform.system} "dev";
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
in craneLib.devShell {
|
||||
packages = [
|
||||
toolchain
|
||||
fenixPkgs.rust-analyzer
|
||||
pkgs.lldb_21
|
||||
];
|
||||
}
|
||||
|
|
|
|||
13
rust/cargo-nightly/crane+fenix/toolchain.nix
Normal file
13
rust/cargo-nightly/crane+fenix/toolchain.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
fenixPkgs: proc:
|
||||
fenixPkgs.complete.withComponents ([
|
||||
"rustc"
|
||||
"rust-std"
|
||||
"cargo"
|
||||
] ++ (if proc != "build" then [
|
||||
"clippy"
|
||||
] else []) ++ (if proc == "dev" then [
|
||||
"rust-docs"
|
||||
"rustfmt"
|
||||
"rust-src"
|
||||
"rust-analyzer"
|
||||
] else []))
|
||||
|
|
@ -1,15 +1,12 @@
|
|||
{ pkgs ? import <nixpkgs> {},
|
||||
fenix ? builtins.getFlake "github:nix-community/fenix",
|
||||
fenixToolchain ? "default"
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) mkShellNoCC;
|
||||
fenixPkgs = fenix.packages.${pkgs.system};
|
||||
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
|
||||
toolchain = import ./toolchain.nix fenix.packages.${pkgs.stdenv.hostPlatform.system} "dev";
|
||||
in mkShellNoCC {
|
||||
packages = [
|
||||
toolchain
|
||||
fenixPkgs.rust-analyzer
|
||||
pkgs.lldb_21
|
||||
];
|
||||
}
|
||||
|
|
|
|||
13
rust/cargo-nightly/nixpkgs+fenix/toolchain.nix
Normal file
13
rust/cargo-nightly/nixpkgs+fenix/toolchain.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
fenixPkgs: proc:
|
||||
fenixPkgs.complete.withComponents ([
|
||||
"rustc"
|
||||
"rust-std"
|
||||
"cargo"
|
||||
] ++ (if proc != "build" then [
|
||||
"clippy"
|
||||
] else []) ++ (if proc == "dev" then [
|
||||
"rust-docs"
|
||||
"rustfmt"
|
||||
"rust-src"
|
||||
"rust-analyzer"
|
||||
] else []))
|
||||
Loading…
Add table
Add a link
Reference in a new issue