fix(tvix/store): Remove virtiofs from default features

vhost-user-backend doesn't support macOS yet, so the virtiofs features
will not work on macOS. This removes it as a default feature which makes
`cargo build` work out of the box on macOS.

The `virtiofs` feature is enabled for Linux when building via Nix, but
if being built by cargo directly, the feature must be enabled via a
cargo flag.

Change-Id: I2aaca9582f8e3dbcf9ee5f1b9831d614909f3799
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9555
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Connor Brewster 2023-10-06 21:17:35 -05:00 committed by clbot
parent 9c0d66197b
commit 9019d8568e
4 changed files with 7 additions and 3 deletions

View file

@ -8880,7 +8880,7 @@ rec {
} }
]; ];
features = { features = {
"default" = [ "fuse" "virtiofs" "tonic-reflection" ]; "default" = [ "fuse" "tonic-reflection" ];
"fs" = [ "dep:libc" "dep:fuse-backend-rs" ]; "fs" = [ "dep:libc" "dep:fuse-backend-rs" ];
"fuse" = [ "fs" ]; "fuse" = [ "fs" ];
"tonic-reflection" = [ "dep:tonic-reflection" "tvix-castore/tonic-reflection" ]; "tonic-reflection" = [ "dep:tonic-reflection" "tvix-castore/tonic-reflection" ];

View file

@ -5,6 +5,8 @@ let
# crate override for crates that need protobuf # crate override for crates that need protobuf
protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ];
iconvDarwinDep = lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ]; iconvDarwinDep = lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
# fuse-backend-rs uses DiskArbitration framework to handle mount/unmount on Darwin
diskArbitrationDep = lib.optionals pkgs.stdenv.isDarwin [ pkgs.buildPackages.darwin.apple_sdk.frameworks.DiskArbitration ];
# Load the crate2nix crate tree. # Load the crate2nix crate tree.
crates = import ./Cargo.nix { crates = import ./Cargo.nix {
@ -44,6 +46,7 @@ let
tvix-store = prev: { tvix-store = prev: {
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = depot.tvix.proto;
nativeBuildInputs = protobufDep prev; nativeBuildInputs = protobufDep prev;
buildInputs = prev.buildInputs or [ ] ++ diskArbitrationDep;
}; };
}; };
}; };

View file

@ -80,7 +80,7 @@ tempfile = "3.3.0"
tonic-mock = { git = "https://github.com/brainrake/tonic-mock", branch = "bump-dependencies" } tonic-mock = { git = "https://github.com/brainrake/tonic-mock", branch = "bump-dependencies" }
[features] [features]
default = ["fuse", "virtiofs", "tonic-reflection"] default = ["fuse", "tonic-reflection"]
fs = ["dep:libc", "dep:fuse-backend-rs"] fs = ["dep:libc", "dep:fuse-backend-rs"]
virtiofs = [ virtiofs = [
"fs", "fs",

View file

@ -25,7 +25,8 @@ in
(depot.tvix.crates.workspaceMembers.tvix-store.build.override { (depot.tvix.crates.workspaceMembers.tvix-store.build.override {
runTests = true; runTests = true;
# virtiofs feature currently fails to build on Darwin. # virtiofs feature currently fails to build on Darwin.
features = if pkgs.stdenv.isDarwin then [ "fuse" "tonic-reflection" ] else [ "default" ]; # we however can ship it for non-darwin.
features = if pkgs.stdenv.isDarwin then [ "default" ] else [ "default" "virtiofs" ];
}).overrideAttrs (_: { }).overrideAttrs (_: {
meta.ci.extraSteps = { meta.ci.extraSteps = {
import-docs = (mkImportCheck "tvix/store/docs" ./docs); import-docs = (mkImportCheck "tvix/store/docs" ./docs);