diff options
author | Kane York <kanepyork@gmail.com> | 2020-08-02T00·20-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-08-03T17·06+0000 |
commit | 8a1c7da357873a645405c0f5b8cc75d751dedb83 (patch) | |
tree | 6c9408d623e0959077a30bac882e360f08df6bec /third_party | |
parent | 0d8bb25bae36ad9e6abb516ee8ec2685c94f0e08 (diff) |
feat(3p/nix/build-shell): add run_clang_tidy script r/1566
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>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/nix/default.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix index 704ba3f5fa66..adb1bd33d1ec 100644 --- a/third_party/nix/default.nix +++ b/third_party/nix/default.nix @@ -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 |