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 <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-10-16 14:52:31 +01:00 committed by clbot
parent 6aa8a1a8ea
commit 5ce1a03a3a

View file

@ -4,9 +4,7 @@
let 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.optional 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 {
@ -27,7 +25,8 @@ let
defaultCrateOverrides = pkgs.defaultCrateOverrides // { defaultCrateOverrides = pkgs.defaultCrateOverrides // {
zstd-sys = prev: { zstd-sys = prev: {
nativeBuildInputs = prev.nativeBuildInputs or [ ] ++ iconvDarwinDep; nativeBuildInputs = prev.nativeBuildInputs or [ ];
buildInputs = prev.buildInputs or [ ] ++ iconvDarwinDep;
}; };
prost-build = prev: { prost-build = prev: {
@ -46,7 +45,9 @@ 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; # 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 ./.; src = depot.third_party.gitignoreSource ./.;
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = depot.tvix.proto;
buildInputs = [
pkgs.fuse
];
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
cargo cargo
pkg-config pkg-config
protobuf protobuf
rustc rustc
rustPlatform.cargoSetupHook rustPlatform.cargoSetupHook
];
buildInputs = [
pkgs.fuse
] ++ iconvDarwinDep; ] ++ iconvDarwinDep;
buildPhase = '' buildPhase = ''