about summary refs log tree commit diff
path: root/tvix/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-07T11·05+0300
committertazjin <tazjin@tvl.su>2022-12-15T17·26+0000
commit3aca3d3bba54eaedefc7c472af8bca16ce1f163d (patch)
treeab80d07c6c787e59ffbe90bb36d97bc35ae26b96 /tvix/default.nix
parentd9d627cdf0507e44f606519384fbebd726eb0593 (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/default.nix')
-rw-r--r--tvix/default.nix14
1 files changed, 5 insertions, 9 deletions
diff --git a/tvix/default.nix b/tvix/default.nix
index 5b10748f3d29..7225bfb89e75 100644
--- a/tvix/default.nix
+++ b/tvix/default.nix
@@ -1,14 +1,10 @@
 # Nix helpers for projects under //tvix
-
 { pkgs, ... }:
 
 {
-  # Construct a sparse tree for naersk's `root` field, for
-  # compatibility with the workspace-workaround (see top-level comment
-  # in //tvix/Cargo.toml)
-  naerskRootFor = cargoToml: pkgs.runCommand "sparse-tvix-root" { } ''
-    mkdir $out
-    cp -aT ${./Cargo.lock} $out/Cargo.lock
-    cp -aT ${cargoToml} $out/Cargo.toml
-  '';
+  # Load the crate2nix crate tree.
+  crates = import ./Cargo.nix {
+    inherit pkgs;
+    nixpkgs = pkgs.path;
+  };
 }