Fix Rust Analyzer

Previously we had warnings about sysroot, and limited feedback. This fix is from the Crane docs section about building standard library crates.
This commit is contained in:
George Thomas 2025-12-04 09:50:55 +00:00
parent a81d622125
commit 23c0777425
2 changed files with 33 additions and 2 deletions

21
flake.lock generated
View File

@ -609,7 +609,28 @@
"nixpkgs": [ "nixpkgs": [
"haskellNix", "haskellNix",
"nixpkgs-unstable" "nixpkgs-unstable"
],
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
] ]
},
"locked": {
"lastModified": 1764816035,
"narHash": "sha256-F0IQSmSj4t2ThkbWZooAhkCTO+YpZSd2Pqiv2uoYEHo=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "74d9abb7c5c030469f90d97a67d127cc5d76c238",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
} }
}, },
"stackage": { "stackage": {

View File

@ -3,7 +3,11 @@
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable"; inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.crane.url = "github:ipetkov/crane"; inputs.crane.url = "github:ipetkov/crane";
outputs = { self, nixpkgs, flake-utils, haskellNix, crane }: inputs.rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, haskellNix, crane, rust-overlay }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let let
overlays = [ overlays = [
@ -15,10 +19,16 @@
evalSystem = "x86_64-linux"; evalSystem = "x86_64-linux";
}; };
}) })
(import rust-overlay)
]; ];
pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
haskell = pkgs.hixProject.flake { }; haskell = pkgs.hixProject.flake { };
rust = crane.mkLib pkgs; rust = (crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.selectLatestNightlyWith (
toolchain: toolchain.default.override {
extensions = [ "rust-src" ];
targets = [ "x86_64-unknown-linux-gnu" ];
}
));
in in
{ {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {