Skip to content

Commit

Permalink
Merge pull request cachix#156 from winterqt/fix-rustfmt-and-clippy
Browse files Browse the repository at this point in the history
Fix rustfmt and Clippy hooks
  • Loading branch information
domenkozar authored Jul 23, 2022
2 parents db3bd55 + 75a58e9 commit f436e6d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,40 @@ in
entry = "${tools.yamllint}/bin/yamllint";
};
rustfmt =
let
wrapper = pkgs.symlinkJoin {
name = "rustfmt-wrapped";
paths = [ tools.rustfmt ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/cargo-fmt \
--prefix PATH : ${lib.makeBinPath [ tools.cargo ]}
'';
};
in
{
name = "rustfmt";
description = "Format Rust code.";
entry = "${tools.rustfmt}/bin/cargo-fmt fmt -- --check --color always";
entry = "${wrapper}/bin/cargo-fmt fmt -- --check --color always";
files = "\\.rs$";
pass_filenames = false;
};
clippy =
let
wrapper = pkgs.symlinkJoin {
name = "clippy-wrapped";
paths = [ tools.clippy ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/cargo-clippy \
--prefix PATH : ${lib.makeBinPath [ tools.cargo ]}
'';
};
in
{
name = "clippy";
description = "Lint Rust code.";
entry = "${tools.clippy}/bin/cargo-clippy clippy";
entry = "${wrapper}/bin/cargo-clippy clippy";
files = "\\.rs$";
pass_filenames = false;
};
Expand Down

0 comments on commit f436e6d

Please sign in to comment.