File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [workspace ]
2+ members = []
3+ resolver = " 3"
4+
5+ [workspace .dependencies ]
6+
7+ [workspace .lints .clippy ]
8+ all = " deny"
9+ expect_used = " deny"
10+ nursery = " deny"
11+ panic = " deny"
12+ pedantic = " deny"
13+ todo = " deny"
14+ unimplemented = " deny"
15+ unwrap_used = " deny"
16+
17+ [workspace .lints .rust ]
18+ future_incompatible = " deny"
19+ unsafe_code = " deny"
20+ unused = " deny"
21+
22+ [workspace .metadata .crane ]
23+ name = " labs"
24+
25+ [workspace .package ]
26+ edition = " 2024"
27+ version = " 0.0.0"
Original file line number Diff line number Diff line change 77 git-hooks . inputs . nixpkgs . follows = "nixpkgs" ;
88 treefmt-nix . url = "github:numtide/treefmt-nix" ;
99 treefmt-nix . inputs . nixpkgs . follows = "nixpkgs" ;
10+ rust-overlay . url = "github:oxalica/rust-overlay" ;
11+ rust-overlay . inputs . nixpkgs . follows = "nixpkgs" ;
12+ crane . url = "github:ipetkov/crane" ;
1013 } ;
1114
1215 outputs =
2629 system ,
2730 ...
2831 } :
32+ let
33+ rustToolchain = pkgs . rust-bin . stable . latest . default ;
34+ craneLib = ( inputs . crane . mkLib pkgs ) . overrideToolchain rustToolchain ;
35+ src = pkgs . lib . cleanSourceWith { src = ./. ; } ;
36+ commonArgs = {
37+ inherit src ;
38+ strictDeps = true ;
39+ } ;
40+ cargoArtifacts = craneLib . buildDepsOnly commonArgs ;
41+ in
2942 {
3043 _module . args . pkgs = import inputs . nixpkgs {
3144 inherit system ;
45+ overlays = [ inputs . rust-overlay . overlays . default ] ;
3246 } ;
3347
34- checks = { } ;
48+ checks = {
49+ clippy = craneLib . cargoClippy {
50+ inherit
51+ src
52+ cargoArtifacts
53+ ;
54+ cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings" ;
55+ } ;
56+ test = craneLib . cargoTest {
57+ inherit
58+ src
59+ cargoArtifacts
60+ ;
61+ } ;
62+ } ;
3563
3664 devShells . default = pkgs . mkShellNoCC {
3765 inputsFrom = [ config . pre-commit . devShell ] ;
3866
39- packages = [ ] ;
67+ packages = [ rustToolchain ] ;
4068 } ;
4169
4270 packages = { } ;
5684 projectRootFile = "flake.nix" ;
5785 programs = {
5886 nixfmt . enable = true ;
87+ rustfmt . enable = true ;
88+ rustfmt . package = rustToolchain ;
5989 yamlfmt . enable = true ;
6090 } ;
6191 } ;
You can’t perform that action at this time.
0 commit comments