From c1d8cee215a3e5787d4bd5de91ce029307ac718a Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 2 Oct 2022 14:28:04 -0400 Subject: feat(tvix/eval): Add passthru build for benchmark binaries Add a new derivation target to the passthru of tvix.eval that builds the benchmark binaries, *and* copies them to the outupts of the derivation via the (somewhat arcane) `copyBinsFilter` jq script arg to naersk. This is a bit annoying because (as far as I can tell) the derivations returned by naersk aren't directly overridable, so we have to explicitly fixpoint the attrs we're passing. Also, since this is now a separate target to build the benchmarks, we can remove `--all-targets` from the build of `tvix-eval` itself since that was only added to build benchmarks in CI, and make regular (non-benchmark) builds a bit faster. Change-Id: I136b8526790545e93b1ae666abaefb51cbbee390 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6847 Autosubmit: grfn Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/default.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tvix/eval/default.nix') diff --git a/tvix/eval/default.nix b/tvix/eval/default.nix index aa8d8a4af4..5147ebe8e6 100644 --- a/tvix/eval/default.nix +++ b/tvix/eval/default.nix @@ -1,13 +1,11 @@ { depot, pkgs, lib, ... }: -lib.fix (self: -depot.third_party.naersk.buildPackage { +lib.fix (self: depot.third_party.naersk.buildPackage (lib.fix (naerskArgs: { src = depot.third_party.gitignoreSource ./.; # see https://github.com/nix-community/naersk/issues/169 root = depot.nix.sparseTree ./. [ ./Cargo.lock ./Cargo.toml ]; doCheck = true; - cargoBuildOptions = opts: opts ++ [ "--all-targets" ]; # Tell the test suite where to find upstream nix, to compare eval results # against @@ -15,6 +13,20 @@ depot.third_party.naersk.buildPackage { meta.ci.targets = builtins.attrNames self.passthru; + passthru.benchmarks = depot.third_party.naersk.buildPackage (naerskArgs // { + name = "tvix-eval-benchmarks"; + + doCheck = false; + + cargoBuildOptions = opts: opts ++ [ "--benches" ]; + + copyBinsFilter = '' + select(.reason == "compiler-artifact" and any(.target.kind[] == "bench"; .)) + ''; + + passthru = { }; + }); + passthru.cpp-nix-run-lang-tests = pkgs.stdenv.mkDerivation { name = "cpp-nix-run-lang-tests"; @@ -129,5 +141,5 @@ depot.third_party.naersk.buildPackage { exit $fail ''; }; -} +})) ) -- cgit 1.4.1