From 5ce1a03a3a3a4861cfb451b29286607e0b7ccb20 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 16 Oct 2023 14:52:31 +0100 Subject: refactor(tvix): push rarely-used darwin-specific hacks down Also, make some of them buildInputs, not nativeBuildInputs. We likely need to link against libiconv, so it shouldn't be a native build input. Change-Id: I757bc7f5d8c864ecaa3db26988d00b496c085c8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/9757 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster Autosubmit: flokli --- tvix/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'tvix/default.nix') diff --git a/tvix/default.nix b/tvix/default.nix index 827664894c..3be2b15e65 100644 --- a/tvix/default.nix +++ b/tvix/default.nix @@ -4,9 +4,7 @@ let # crate override for crates that need protobuf protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; - 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 ]; + iconvDarwinDep = lib.optional pkgs.stdenv.isDarwin pkgs.libiconv; # Load the crate2nix crate tree. crates = import ./Cargo.nix { @@ -27,7 +25,8 @@ let defaultCrateOverrides = pkgs.defaultCrateOverrides // { zstd-sys = prev: { - nativeBuildInputs = prev.nativeBuildInputs or [ ] ++ iconvDarwinDep; + nativeBuildInputs = prev.nativeBuildInputs or [ ]; + buildInputs = prev.buildInputs or [ ] ++ iconvDarwinDep; }; prost-build = prev: { @@ -46,7 +45,9 @@ let tvix-store = prev: { PROTO_ROOT = depot.tvix.proto; nativeBuildInputs = protobufDep prev; - buildInputs = prev.buildInputs or [ ] ++ diskArbitrationDep; + # fuse-backend-rs uses DiskArbitration framework to handle mount/unmount on Darwin + buildInputs = prev.buildInputs or [ ] + ++ lib.optional pkgs.stdenv.isDarwin pkgs.buildPackages.darwin.apple_sdk.frameworks.DiskArbitration; }; }; }; @@ -118,15 +119,16 @@ in src = depot.third_party.gitignoreSource ./.; PROTO_ROOT = depot.tvix.proto; - buildInputs = [ - pkgs.fuse - ]; nativeBuildInputs = with pkgs; [ cargo pkg-config protobuf rustc rustPlatform.cargoSetupHook + ]; + + buildInputs = [ + pkgs.fuse ] ++ iconvDarwinDep; buildPhase = '' -- cgit 1.4.1