fix(tvix/shell): fix shell on MacOS

runc is not available on MacOS, we only want to include it in the shell if on
Linux.

Point TVIX_BUILD_SANDBOX_SHELL to /bin/sh if not on Linux.
While we cannot use the OCI/runc executor on MacOS, other implementations might
make use of this env var, so it's good to keep setting it.

Also update the other occurence of it, in tvix/utils.nix.

Change-Id: If7b47e1bb7c41bbde84c93016713754a252c4355
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12691
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-10-27 13:19:27 +01:00 committed by clbot
parent 4c90f723d8
commit 057e4e3a99
2 changed files with 4 additions and 3 deletions

View file

@ -48,12 +48,13 @@ pkgs.mkShell {
pkgs.mdbook-plantuml pkgs.mdbook-plantuml
pkgs.nix_2_3 # b/313 pkgs.nix_2_3 # b/313
pkgs.pkg-config pkgs.pkg-config
pkgs.runc
pkgs.rust-analyzer pkgs.rust-analyzer
pkgs.rustc pkgs.rustc
pkgs.rustfmt pkgs.rustfmt
pkgs.plantuml pkgs.plantuml
pkgs.protobuf pkgs.protobuf
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.runc
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# We need these two dependencies in the ambient environment to be able to # We need these two dependencies in the ambient environment to be able to
# `cargo build` on MacOS. # `cargo build` on MacOS.
@ -67,7 +68,7 @@ pkgs.mkShell {
# should also benchmark with a more static nixpkgs checkout, so nixpkgs # should also benchmark with a more static nixpkgs checkout, so nixpkgs
# refactorings are not observed as eval perf changes. # refactorings are not observed as eval perf changes.
shellHook = '' shellHook = ''
export TVIX_BUILD_SANDBOX_SHELL=${pkgs.busybox-sandbox-shell}/bin/busybox export TVIX_BUILD_SANDBOX_SHELL=${if pkgs.stdenv.isLinux then pkgs.busybox-sandbox-shell + "/bin/busybox" else "/bin/sh"}
export TVIX_BENCH_NIX_PATH=nixpkgs=${pkgs.path} export TVIX_BENCH_NIX_PATH=nixpkgs=${pkgs.path}
''; '';
} }

View file

@ -79,7 +79,7 @@
PROTO_ROOT = depot.tvix.build.protos.protos; PROTO_ROOT = depot.tvix.build.protos.protos;
nativeBuildInputs = [ pkgs.protobuf ]; nativeBuildInputs = [ pkgs.protobuf ];
buildInputs = lib.optional pkgs.stdenv.isDarwin commonDarwinDeps; buildInputs = lib.optional pkgs.stdenv.isDarwin commonDarwinDeps;
TVIX_BUILD_SANDBOX_SHELL = "${pkgs.pkgsStatic.busybox}/bin/sh"; TVIX_BUILD_SANDBOX_SHELL = if pkgs.stdenv.isLinux then pkgs.pkgsStatic.busybox + "/bin/sh" else "/bin/sh";
}; };
tvix-castore = prev: { tvix-castore = prev: {