From 4be250109cb5df976cb137a3f631bc9f23faa952 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 16 Jun 2024 10:43:08 +0300 Subject: [PATCH] refactor(tvix/store): drop FUSE multithread workaround for Darwin The underlying issue in macFUSE has been fixed in https://github.com/osxfuse/osxfuse/issues/974. Bump our `macfuse` in nixpkgs to a version containing the fix. This can be removed while our nixpkgs pin is bumped past https://github.com/NixOS/nixpkgs/pull/320197. Change-Id: Ia0e644fb13198e45018b0a218647ef211acf4df1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11824 Tested-by: BuildkiteCI Reviewed-by: Brian Olsen --- third_party/overlays/tvl.nix | 13 +++++++++++++ tvix/shell.nix | 13 +++++++++++++ tvix/store/src/bin/tvix-store.rs | 9 +-------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/third_party/overlays/tvl.nix b/third_party/overlays/tvl.nix index a23c17eb6..a203866d3 100644 --- a/third_party/overlays/tvl.nix +++ b/third_party/overlays/tvl.nix @@ -120,4 +120,17 @@ depot.nix.readTree.drvTargets { tpm2-pkcs11 = super.tpm2-pkcs11.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ ./patches/tpm2-pkcs11-190-dbupgrade.patch ]; }); + + # macFUSE bump containing fix for https://github.com/osxfuse/osxfuse/issues/974 + # https://github.com/NixOS/nixpkgs/pull/320197 + fuse = + if super.stdenv.isDarwin then + super.fuse.overrideAttrs + (old: rec { + version = "4.8.0"; + src = super.fetchurl { + url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg"; + hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ="; + }; + }) else super.fuse; } diff --git a/tvix/shell.nix b/tvix/shell.nix index eae0931bf..947cda269 100644 --- a/tvix/shell.nix +++ b/tvix/shell.nix @@ -16,6 +16,19 @@ ./nixpkgs/cbtemulator-uds.patch ]; }); + + # macFUSE bump containing fix for https://github.com/osxfuse/osxfuse/issues/974 + # https://github.com/NixOS/nixpkgs/pull/320197 + fuse = + if super.stdenv.isDarwin then + super.fuse.overrideAttrs + (old: rec { + version = "4.8.0"; + src = super.fetchurl { + url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg"; + hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ="; + }; + }) else super.fuse; }) ]; }) diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index 4353cbdd0..9e81e59f1 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -185,19 +185,12 @@ enum Commands { }, } -#[cfg(all(feature = "fuse", not(target_os = "macos")))] +#[cfg(feature = "fuse")] fn default_threads() -> usize { std::thread::available_parallelism() .map(|threads| threads.into()) .unwrap_or(4) } -// On MacFUSE only a single channel will receive ENODEV when the file system is -// unmounted and so all the other channels will block forever. -// See https://github.com/osxfuse/osxfuse/issues/974 -#[cfg(all(feature = "fuse", target_os = "macos"))] -fn default_threads() -> usize { - 1 -} #[instrument(fields(indicatif.pb_show=1), skip(cli))] async fn run_cli(cli: Cli) -> Result<(), Box> {