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:
|
packages = eachSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
|
toolchain = import ./toolchain.nix fenix.packages.${system} "build";
|
||||||
in {
|
in {
|
||||||
hello = pkgs.callPackage ./package.nix {
|
hello = pkgs.callPackage ./package.nix {
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
checks = eachSystem (system:
|
checks = eachSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
|
toolchain = import ./toolchain.nix fenix.packages.${system} "check";
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||||
crate = self.packages.${system}.default;
|
crate = self.packages.${system}.default;
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
{ pkgs ? import <nixpkgs> {},
|
{ pkgs ? import <nixpkgs> {},
|
||||||
crane ? builtins.getFlake "github:ipetkov/crane",
|
crane ? builtins.getFlake "github:ipetkov/crane",
|
||||||
fenix ? builtins.getFlake "github:nix-community/fenix",
|
fenix ? builtins.getFlake "github:nix-community/fenix",
|
||||||
fenixToolchain ? "default"
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
fenixPkgs = fenix.packages.${pkgs.system};
|
toolchain = import ./toolchain.nix fenix.packages.${pkgs.stdenv.hostPlatform.system} "dev";
|
||||||
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
|
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||||
in craneLib.devShell {
|
in craneLib.devShell {
|
||||||
packages = [
|
packages = [
|
||||||
toolchain
|
toolchain
|
||||||
fenixPkgs.rust-analyzer
|
|
||||||
pkgs.lldb_21
|
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> {},
|
{ pkgs ? import <nixpkgs> {},
|
||||||
fenix ? builtins.getFlake "github:nix-community/fenix",
|
fenix ? builtins.getFlake "github:nix-community/fenix",
|
||||||
fenixToolchain ? "default"
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) mkShellNoCC;
|
inherit (pkgs) mkShellNoCC;
|
||||||
fenixPkgs = fenix.packages.${pkgs.system};
|
toolchain = import ./toolchain.nix fenix.packages.${pkgs.stdenv.hostPlatform.system} "dev";
|
||||||
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
|
|
||||||
in mkShellNoCC {
|
in mkShellNoCC {
|
||||||
packages = [
|
packages = [
|
||||||
toolchain
|
toolchain
|
||||||
fenixPkgs.rust-analyzer
|
|
||||||
pkgs.lldb_21
|
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