File tree 2 files changed +62
-12
lines changed
2 files changed +62
-12
lines changed Original file line number Diff line number Diff line change 3
3
flakeCompat . url = github:edolstra/flake-compat ;
4
4
flakeCompat . flake = false ;
5
5
flakeUtils . url = "github:numtide/flake-utils" ;
6
- nixpkgs . url = "github:nixos/nixpkgs/nixpkgs-unstable" ;
6
+ nixpkgs . follows = "fenix/nixpkgs" ;
7
+ # add https://app.cachix.org/cache/nix-community to your `nix.conf`
8
+ fenix . url = "github:nix-community/fenix" ;
7
9
} ;
8
10
outputs =
9
11
inputs :
10
12
inputs . flakeUtils . lib . eachDefaultSystem
11
13
(
12
14
system :
13
15
let
16
+ toolchain = "stable" ;
14
17
nixpkgs = import inputs . nixpkgs { inherit system ; } ;
15
18
cargoToml = builtins . fromTOML ( builtins . readFile ./Cargo.toml ) ;
16
19
in
21
24
} ;
22
25
defaultApp = { type = "app" ; program = "${ inputs . self . defaultPackage . ${ system } } /bin/alejandra" ; } ;
23
26
defaultPackage =
24
- nixpkgs . rustPlatform . buildRustPackage
27
+ ( nixpkgs . makeRustPlatform {
28
+ inherit ( inputs . fenix . packages . ${ system } . ${ toolchain } ) cargo rustc ;
29
+ } ) . buildRustPackage
25
30
{
26
31
pname = cargoToml . package . name ;
27
32
version =
43
48
devShell =
44
49
nixpkgs . mkShell
45
50
{
46
- packages = [ nixpkgs . cargo-tarpaulin nixpkgs . rustup ] ;
47
- shellHook =
48
- ''
49
- rustup toolchain install nightly
50
- '' ;
51
+ packages = [
52
+ inputs . fenix . packages . ${ system } . rust-analyzer
53
+ ( inputs . fenix . packages . ${ system } . ${ toolchain } . withComponents [
54
+ "cargo"
55
+ "clippy"
56
+ "rust-src"
57
+ "rustc"
58
+ "rustfmt"
59
+ ] )
60
+ ] ;
51
61
} ;
52
62
packages = {
53
63
nixpkgsFormatted =
You can’t perform that action at this time.
0 commit comments