I’m trying to create a devShell for an existing large project that, among other things, runs React Native. When running react-native run-ios
it runs an xcodebuild
which relies on clang
flags that are only valid for the XCode command line tools version of clang.
It seems like nix develop
in and of itself depends on clang-wrapper
so clang is in my devShells PATH ahead of XCode’s tools which causes my builds to fail when we run xcodebuild
as it tries to pass arguments to clang which the devShell version does not support.
$ which clang
/nix/store/nwfcj1p4l74krm4n6szrb0c534p4ai2s-clang-wrapper-11.1.0/bin/clang
$ react-native run-ios
...
clang-11: error: unknown argument: '-index-store-path'
clang-11: error: cannot specify -o when generating multiple output files
Unfortunately, just shoving all of /Library/Developer/CommandLineTools/usr/bin
in front of my PATH when running this command leads to other issues of it then using ld
instead of clang
for linking which it seems others have run into without any answers.
My flake.nix
isn’t doing anything special, just some packages and a few env vars to setup Apple framework SDKs, and I confirmed with just a simple flake that clang is still shadowed by the dev shell:
{
outputs = { self, nixpkgs }:
let pkgs = import nixpkgs { system = "aarch64-darwin"; };
in {
devShells.aarch64-darwin.default = pkgs.mkShell {
packages = with pkgs; [ cowsay ];
};
};
}
Is there any way to run react native build tooling inside a nix shell? I’ve struggled to find any examples and the docs only really talk about the quirks with creating xcode ios derivations, not devshells that work with existing build tools.
To clarify, I’m currently just trying to get a dev shell suitable to run our existing build pipelines (yarn, node, react-native cli), not fully convert to a nix derivation. I’ve been able to figure out all the other bits, but the react-native build is still stumping me.