about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2022-10-02T18·28-0400
committerclbot <clbot@tvl.fyi>2022-10-02T22·43+0000
commitc1d8cee215a3e5787d4bd5de91ce029307ac718a (patch)
treebf4618d33202f88ce71ced32d03cdf20b3bb683b /tvix/eval
parente255aff8492b4d3f1c5e6e95e4074aa7aae12514 (diff)
feat(tvix/eval): Add passthru build for benchmark binaries r/5018
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 <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/default.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/tvix/eval/default.nix b/tvix/eval/default.nix
index aa8d8a4af414..5147ebe8e678 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
     '';
   };
-}
+}))
 )