File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 14
14
flake-utils . lib . eachDefaultSystem ( system :
15
15
let
16
16
pkgs = nixpkgs . legacyPackages . ${ system } ;
17
+
18
+ cargoBuildInputs = with pkgs ; lib . optionals stdenv . isDarwin [
19
+ darwin . apple_sdk . frameworks . CoreServices
20
+ ] ;
21
+
17
22
rustlings =
18
23
pkgs . rustPlatform . buildRustPackage {
19
24
name = "rustlings" ;
20
25
version = "5.3.0" ;
21
26
27
+ buildInputs = cargoBuildInputs ;
28
+
22
29
src = with pkgs . lib ; cleanSourceWith {
23
30
src = self ;
24
31
# a function that returns a bool determining if the path should be included in the cleaned source
42
49
in
43
50
{
44
51
devShell = pkgs . mkShell {
52
+ RUST_SRC_PATH = "${ pkgs . rust . packages . stable . rustPlatform . rustLibSrc } " ;
53
+
45
54
buildInputs = with pkgs ; [
46
55
cargo
47
56
rustc
48
57
rust-analyzer
49
58
rustlings
50
- ] ;
59
+ rustfmt
60
+ clippy
61
+ ] ++ cargoBuildInputs ;
51
62
} ;
52
63
} ) ;
53
64
}
Original file line number Diff line number Diff line change 1
1
use glob:: glob;
2
2
use serde:: { Deserialize , Serialize } ;
3
+ use std:: env;
3
4
use std:: error:: Error ;
4
5
use std:: process:: Command ;
5
6
@@ -64,6 +65,12 @@ impl RustAnalyzerProject {
64
65
65
66
/// Use `rustc` to determine the default toolchain
66
67
pub fn get_sysroot_src ( & mut self ) -> Result < ( ) , Box < dyn Error > > {
68
+ // check if RUST_SRC_PATH is set
69
+ if let Ok ( path) = env:: var ( "RUST_SRC_PATH" ) {
70
+ self . sysroot_src = path;
71
+ return Ok ( ( ) ) ;
72
+ }
73
+
67
74
let toolchain = Command :: new ( "rustc" )
68
75
. arg ( "--print" )
69
76
. arg ( "sysroot" )
You can’t perform that action at this time.
0 commit comments