about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-19T16·46+0100
committertazjin <mail@tazj.in>2020-07-19T16·54+0000
commit02066a4bab3f534569c61f571c25d519a1a569ad (patch)
treeaf98eeb0feff36be97371535b8620beb0869fd4f /third_party
parent61a7b97c3927f28ef588196bc2efbd8c6cceb8c4 (diff)
chore(3p/nix): Enable clang-format check in derivation build r/1399
This is the easiest way to get the checks up and running for now, but
we will probably want to separate out things like this into a separate
build step in the future.

Change-Id: I8e1a1095aef09b1eee97abad5b6240bc64d14b8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1287
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/default.nix1
-rw-r--r--third_party/nix/default.nix7
-rw-r--r--third_party/nix/src/tests/value-to-json.cc1
3 files changed, 7 insertions, 2 deletions
diff --git a/third_party/default.nix b/third_party/default.nix
index f9b963f152..d1fd9f370f 100644
--- a/third_party/default.nix
+++ b/third_party/default.nix
@@ -65,6 +65,7 @@ let
       diffutils
       dockerTools
       execline
+      fd
       fetchFromGitHub
       fetchgit
       fetchurl
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index cceb6b4f1b..1ab729e43a 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -37,9 +37,9 @@ in pkgs.llvmPackages.libcxxStdenv.mkDerivation {
     bison
     clang-tools
     cmake
-    pkgconfig
     libxml2
     libxslt
+    pkgconfig
     (import ./clangd.nix pkgs)
   ];
 
@@ -67,6 +67,7 @@ in pkgs.llvmPackages.libcxxStdenv.mkDerivation {
   doInstallCheck = true;
 
   installCheckInputs = with pkgs; [
+    fd
     gtest
     rapidcheck
   ];
@@ -91,6 +92,10 @@ in pkgs.llvmPackages.libcxxStdenv.mkDerivation {
     export NIX_DATA_DIR=$out/share
     export NIX_TEST_VAR=foo # this is required by a language test
     make test
+
+    # Ensure formatting is coherent, but do this after the rest of the
+    # tests run so that developers get all the useful feedback
+    fd . $src -e hh -e cc | xargs clang-format --dry-run --Werror
   '';
 
   preBuild = ''
diff --git a/third_party/nix/src/tests/value-to-json.cc b/third_party/nix/src/tests/value-to-json.cc
index fddeae512b..573eb65828 100644
--- a/third_party/nix/src/tests/value-to-json.cc
+++ b/third_party/nix/src/tests/value-to-json.cc
@@ -8,7 +8,6 @@
 #include "libexpr/value-to-xml.hh"
 #include "libexpr/value.hh"
 #include "libstore/store-api.hh"
-
 #include "tests/dummy-store.hh"
 
 class ValueTest : public ::testing::Test {