diff options
author | zseri <zseri.devel@ytrizja.de> | 2021-12-26T05·10+0100 |
---|---|---|
committer | zseri <zseri.devel@ytrizja.de> | 2021-12-27T04·10+0000 |
commit | 358a4ac6d4c08bd3b485d0fc44f23e7d2676a487 (patch) | |
tree | 3b16394643a9f2ccf113c92622d5574c0ed9d1b3 /third_party/nix | |
parent | b5a5f68fffb852f66766b54a83da8871bf474d88 (diff) |
feat(3p/tvix): run formatting check in parallel to rest r/3461
Change-Id: Ia5b3a5e76672143df361fec375903e3582694112 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4632 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: zseri <zseri.devel@ytrizja.de> Autosubmit: zseri <zseri.devel@ytrizja.de>
Diffstat (limited to 'third_party/nix')
-rw-r--r-- | third_party/nix/default.nix | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix index 3fc89fc7ebdc..e01fad12f034 100644 --- a/third_party/nix/default.nix +++ b/third_party/nix/default.nix @@ -125,10 +125,6 @@ in lib.fix (self: pkgs.fullLlvm11Stdenv.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 = '' @@ -201,6 +197,41 @@ in lib.fix (self: pkgs.fullLlvm11Stdenv.mkDerivation { export NIX_TEST_VAR=foo ''; }); + + # Ensure formatting is coherent, + # but do this in parallel to the main build because: + # - (in favor of building this after tvix) + # tests run so that developers get all the useful feedback + # - (in favor of building this before tvix) + # if the formatting is broken, and this build was submitted to CI + # it would be a good idea to get this feedback rather sooner than later + # - we don't want builds to differ between local and CI runs + checkfmt = pkgs.fullLlvm11Stdenv.mkDerivation { + name = "tvix-checkfmt"; + inherit src; + nativeBuildInputs = with pkgs; [ clang-tools_11 fd ]; + SANDBOX_SHELL = "${pkgs.busybox}/bin/busybox"; + + buildPhase = '' + set -e + runHook preBuild + fd . $src -e hh -e cc | xargs clang-format --dry-run --Werror + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + touch $out + runHook postInstall + ''; + }; + test-vm = import ./test-vm.nix args; }; + + meta = { + targets = [ + "checkfmt" + ]; + }; }) |