feat(3p/nix/build-shell): add run_clang_tidy script
This makes it easy to quickly run clang-tidy on tvix without seeing errors from the generated files. Change-Id: I0e25089c5626aebdb5c016629a68da9ccd26c124 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1556 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
0d8bb25bae
commit
8a1c7da357
1 changed files with 8 additions and 1 deletions
9
third_party/nix/default.nix
vendored
9
third_party/nix/default.nix
vendored
|
@ -150,7 +150,14 @@ in lib.fix (self: pkgs.llvmPackages.libcxxStdenv.mkDerivation {
|
|||
# TODO(tazjin): docs generation?
|
||||
|
||||
passthru = {
|
||||
build-shell = self.overrideAttrs (_: {
|
||||
build-shell = self.overrideAttrs (up: rec {
|
||||
run_clang_tidy = pkgs.writeShellScriptBin "run-clang-tidy" ''
|
||||
test -f compile_commands.json || (echo "run from build output directory"; exit 1) || exit 1
|
||||
${pkgs.jq}/bin/jq < compile_commands.json -r 'map(.file)|.[]' | grep -v '/generated/' | ${pkgs.parallel}/bin/parallel ${pkgs.clang-tools}/bin/clang-tidy -p compile_commands.json $@
|
||||
'';
|
||||
|
||||
installCheckInputs = up.installCheckInputs ++ [run_clang_tidy];
|
||||
|
||||
shellHook = ''
|
||||
export NIX_DATA_DIR="${toString depotPath}/third_party"
|
||||
export NIX_TEST_VAR=foo
|
||||
|
|
Loading…
Reference in a new issue