Skip to content

Commit 6c0e789

Browse files
authored
chore(devshell): add rustfmt + clippy + libclang for parity with CI (#32)
The `nix develop` shell brings the build inputs of the `visage` package via `inputsFrom`, but not the cargo subcommands CI gates on: - `cargo fmt --all -- --check` - `cargo clippy --workspace -- -D warnings` `dtolnay/rust-toolchain@stable` bundles both in the CI workflow; the devshell didn't, so a contributor running `nix develop && cargo fmt` hit "error: no such command: `fmt`" — same for clippy. Also exposes `llvmPackages.libclang` + `LIBCLANG_PATH`, since `v4l2-sys-mit` runs `bindgen` at build time and fails with "Unable to find libclang" otherwise. Surfaced when running `cargo check -p visaged` locally. Verified: `cargo fmt --all -- --check` and `cargo clippy --workspace` now run inside `nix develop` without further env tweaking. No effect on CI (CI doesn't use the devshell). No effect on packaged outputs (this only touches `devShells.default`).
1 parent daa9903 commit 6c0e789

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

flake.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,21 @@
2626
devShells.default = pkgs.mkShell {
2727
inputsFrom = [ visage ];
2828
packages = with pkgs; [
29+
# Toolchain extras that match the CI gates
30+
# (`cargo fmt --check`, `cargo clippy -- -D warnings`).
31+
# `inputsFrom = [ visage ]` brings the compiler but not these.
32+
rustfmt
33+
clippy
34+
# `bindgen` (transitively via `v4l2-sys-mit`) needs libclang.so
35+
# at build time; without LIBCLANG_PATH set, `cargo build -p
36+
# visaged` in the devshell fails with "Unable to find libclang".
37+
llvmPackages.libclang
2938
rust-analyzer
3039
cargo-deb
3140
cargo-watch
3241
];
42+
# Tell bindgen where to find libclang at build time.
43+
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
3344
};
3445
}
3546
) // {

0 commit comments

Comments
 (0)