Skip to content

Commit e1e6c9a

Browse files
authored
Merge pull request #274 from Niols/checkmake
Add hook for `checkmake`
2 parents c77e64a + 543f806 commit e1e6c9a

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ use nix
202202
- [tagref](https://github.com/stepchowfun/tagref)
203203
- [treefmt](https://github.com/numtide/treefmt)
204204
- [topiary](https://github.com/tweag/topiary)
205+
- [checkmake](https://github.com/mrtazz/checkmake)
205206

206207
You must configure which languages should be formatted by `clang_format` using
207208
`clang-format.types_or`. For example to check both C and C++ files:

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/hooks.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,5 +1167,18 @@ in
11671167
pass_filenames = true;
11681168
entry = "${settings.treefmt.package}/bin/treefmt --fail-on-change";
11691169
};
1170+
1171+
checkmake = {
1172+
name = "checkmake";
1173+
description = "Experimental linter/analyzer for Makefiles.";
1174+
types = [ "makefile" ];
1175+
entry =
1176+
## NOTE: `checkmake` 0.2.2 landed in nixpkgs on 12 April 2023. Once
1177+
## this gets into a NixOS release, the following code will be useless.
1178+
lib.throwIf
1179+
(tools.checkmake == null)
1180+
"The version of nixpkgs used by pre-commit-hooks.nix must have `checkmake` in version at least 0.2.2 for it to work on non-Linux systems."
1181+
"${tools.checkmake}/bin/checkmake";
1182+
};
11701183
};
11711184
}

nix/tools.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
{ actionlint
1+
{ stdenv
2+
3+
, actionlint
24
, alejandra
35
, ansible-lint
46
, cabal-fmt
57
, cabal2nix
68
, callPackage
79
, cargo
10+
, checkmake
811
, clang-tools
912
, clippy
1013
, commitizen
@@ -81,4 +84,8 @@ in
8184
chktex = tex;
8285
commitizen = commitizen.overrideAttrs (_: _: { doCheck = false; });
8386
bats = if bats ? withLibraries then (bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])) else bats;
87+
88+
## NOTE: `checkmake` 0.2.2 landed in nixpkgs on 12 April 2023. Once this gets
89+
## into a NixOS release, the following code will be useless.
90+
checkmake = if stdenv.isLinux || checkmake.version >= "0.2.2" then checkmake else null;
8491
}

0 commit comments

Comments
 (0)