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 <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Griffin Smith 2022-10-02 14:28:04 -04:00 committed by clbot
parent e255aff849
commit c1d8cee215

View file

@ -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
'';
};
}
}))
)