Use rust-analyzer from tool chain in devShell

The devShell now uses rust-analyzer from the tool chain. Previously,
using the nixpkgs rust-analyzer (from an older rust version) led to
inaccurate results.
This commit is contained in:
Aaron Würth 2026-02-07 11:45:25 +01:00 committed by Fintan Halpenny
parent d7a4137e23
commit 537eaba8d1
1 changed files with 10 additions and 3 deletions

View File

@ -62,6 +62,14 @@
commonArgs = mkCommonArgs craneLib; commonArgs = mkCommonArgs craneLib;
}; };
rustupDevShell = rec {
toolchain = rustup.toolchain.override (prev: {
extensions = prev.extensions ++ ["rust-analyzer"];
});
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
commonArgs = mkCommonArgs craneLib;
};
srcFilters = path: type: srcFilters = path: type:
builtins.any (suffix: lib.hasSuffix suffix path) [ builtins.any (suffix: lib.hasSuffix suffix path) [
".sql" # schemas ".sql" # schemas
@ -336,7 +344,7 @@
}; };
}; };
devShells.default = rustup.craneLib.devShell { devShells.default = rustupDevShell.craneLib.devShell {
inherit (self.checks.${system}.pre-commit-check) shellHook; inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
@ -348,11 +356,10 @@
cargo-nextest cargo-nextest
cargo-semver-checks cargo-semver-checks
ripgrep ripgrep
rust-analyzer
sqlite sqlite
]; ];
env.RUST_SRC_PATH = "${rustup.toolchain}/lib/rustlib/src/rust/library"; env.RUST_SRC_PATH = "${rustupDevShell.toolchain}/lib/rustlib/src/rust/library";
}; };
}); });
} }