diff options
author | Vincent Ambo <mail@tazj.in> | 2022-12-07T11·05+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-12-15T17·26+0000 |
commit | 3aca3d3bba54eaedefc7c472af8bca16ce1f163d (patch) | |
tree | ab80d07c6c787e59ffbe90bb36d97bc35ae26b96 /tvix/eval | |
parent | d9d627cdf0507e44f606519384fbebd726eb0593 (diff) |
refactor(tvix): build Rust projects using crate2nix r/5420
Introduces granular dependency builds using crate2nix, bootstrapped off the generated configuration from the newly introduced workspace (see cl/7533). This commit checks in the generated Cargo.nix file which can be regenerated with a parameterless invocation of `crate2nix generate` in `//tvix`. I tried generating this in IFD, but it turned out to be harder than what seemed worthwhile for now. In this setup, the various build targets for Rust projects end up being attributes of the imported `Cargo.nix` file at the `tvix.crates` attribute. These still lack configuration, however, which has been fixed in the various `default.nix` files of individual projects. Note that we (temporarily) lose the ability to build tvix-eval's benchmarks in CI. I haven't figured out what magic incantation summons them from the void again ... The `eval-okay-readDir` tests from both test suites have been disabled because they fail for unknown reasons when run in this new derivation. Somebody will have to debug it! Change-Id: I2014614ccb9c8951aedbd71df7966ca191a13695 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7538 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/default.nix | 39 | ||||
-rw-r--r-- | tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.exp (renamed from tvix/eval/src/tests/nix_tests/eval-okay-readDir.exp) | 0 | ||||
-rw-r--r-- | tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.nix (renamed from tvix/eval/src/tests/nix_tests/eval-okay-readDir.nix) | 0 | ||||
-rw-r--r-- | tvix/eval/src/tests/nix_tests/notyetpassing/readDir/bar (renamed from tvix/eval/src/tests/nix_tests/readDir/bar) | 0 | ||||
-rw-r--r-- | tvix/eval/src/tests/nix_tests/notyetpassing/readDir/foo/git-hates-directories (renamed from tvix/eval/src/tests/nix_tests/readDir/foo/git-hates-directories) | 0 | ||||
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix.disabled (renamed from tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix) | 0 |
6 files changed, 7 insertions, 32 deletions
diff --git a/tvix/eval/default.nix b/tvix/eval/default.nix index f7480e826828..91661291f7b6 100644 --- a/tvix/eval/default.nix +++ b/tvix/eval/default.nix @@ -1,34 +1,9 @@ -{ depot, pkgs, lib, ... }: +# TODO: find a way to build the benchmarks via crate2nix +{ depot, pkgs, ... }: -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.tvix.naerskRootFor ./Cargo.toml; +depot.tvix.crates.workspaceMembers.tvix-eval.build.override { + runTests = true; - doCheck = true; - - # Tell the test suite where to find upstream nix, to compare eval results - # against - NIX_INSTANTIATE_BINARY_PATH = "${pkgs.nix}/bin/nix-instantiate"; - - meta.ci.targets = builtins.attrNames self.passthru; - - copySources = [ - "builtin-macros" - ]; - - 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 = { }; - }); -})) -) + # Make C++ Nix available, to compare eval results against. + testInputs = [ pkgs.nix ]; +} diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-readDir.exp b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.exp index bf8d2c14ea4f..bf8d2c14ea4f 100644 --- a/tvix/eval/src/tests/nix_tests/eval-okay-readDir.exp +++ b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.exp diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-readDir.nix b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.nix index a7ec9292aae2..a7ec9292aae2 100644 --- a/tvix/eval/src/tests/nix_tests/eval-okay-readDir.nix +++ b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-readDir.nix diff --git a/tvix/eval/src/tests/nix_tests/readDir/bar b/tvix/eval/src/tests/nix_tests/notyetpassing/readDir/bar index e69de29bb2d1..e69de29bb2d1 100644 --- a/tvix/eval/src/tests/nix_tests/readDir/bar +++ b/tvix/eval/src/tests/nix_tests/notyetpassing/readDir/bar diff --git a/tvix/eval/src/tests/nix_tests/readDir/foo/git-hates-directories b/tvix/eval/src/tests/nix_tests/notyetpassing/readDir/foo/git-hates-directories index e69de29bb2d1..e69de29bb2d1 100644 --- a/tvix/eval/src/tests/nix_tests/readDir/foo/git-hates-directories +++ b/tvix/eval/src/tests/nix_tests/notyetpassing/readDir/foo/git-hates-directories diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix.disabled index a7ec9292aae2..a7ec9292aae2 100644 --- a/tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-readDir.nix.disabled |