run cargo fmt as a nix derivation

This commit is contained in:
Alex Auvolat
2025-11-24 18:09:53 +01:00
parent ca296477f3
commit 95693d45b2
3 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ steps:
- name: check formatting
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr devShell --run "cargo fmt -- --check"
- nix-build -j4 --attr flakePackages.fmt
- name: build
image: nixpkgs/nix:nixos-24.05
+8
View File
@@ -30,6 +30,10 @@
inherit system nixpkgs crane rust-overlay extraTestEnv;
release = false;
}).garage-test;
lints = (compile {
inherit system nixpkgs crane rust-overlay;
release = false;
});
in
{
packages = {
@@ -56,6 +60,10 @@
tests-fjall = testWith {
GARAGE_TEST_INTEGRATION_DB_ENGINE = "fjall";
};
# lints (fmt, clippy)
fmt = lints.garage-cargo-fmt;
clippy = lints.garage-cargo-clippy;
};
# ---- developpment shell, for making native builds only ----
+11
View File
@@ -190,4 +190,15 @@ in rec {
pkgs.cacert
];
} // extraTestEnv);
# ---- source code linting ----
garage-cargo-fmt = craneLib.cargoFmt (commonArgs // {
cargoExtraArgs = "";
});
garage-cargo-clippy = craneLib.cargoClippy (commonArgs // {
cargoArtifacts = garage-deps;
cargoClippyExtraArgs = "--all-targets -- -D warnings";
});
}