Having a build that uses the actual version of Rust specified in
Cargo.toml should allow us to catch issues with breaking MSRV compat
more easily.
---
 Cargo.toml |  2 +-
 flake.nix  | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 25a42e50..61aaf58f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "bcachefs-tools"
 version = "1.12.0"
 authors = ["Yuxuan Shui <[email protected]>", "Kayla Firestack 
<[email protected]>", "Kent Overstreet <[email protected]>" ]
 edition = "2021"
-rust-version = "1.77"
+rust-version = "1.77.0"
 
 [[bin]]
 name = "bcachefs"
diff --git a/flake.nix b/flake.nix
index 4f568b40..62bf40ca 100644
--- a/flake.nix
+++ b/flake.nix
@@ -260,6 +260,22 @@
             }
           );
 
+          # cargo clippy with the current minimum supported rust version
+          # according to Cargo.toml
+          checks.msrv =
+            let
+              rustVersion = cargoToml.package.rust-version;
+              common = pkgs.callPackage mkCommon { inherit crane rustVersion; 
};
+            in
+            common.craneLib.cargoClippy (
+              common.args
+              // {
+                pname = "msrv";
+                inherit (common) cargoArtifacts;
+                cargoClippyExtraArgs = "--all-targets --all-features -- --deny 
warnings";
+              }
+            );
+
           devShells.default = pkgs.mkShell {
             inputsFrom = [
               config.packages.default
-- 
2.47.0


Reply via email to