I've run into these issues a few times, and have yet to find a solution. My environment has Xcode Command-Line tools installed, but since installing Nix, Clang has been having a difficult time locating macOS SDK frameworks. I know these are present, as if I switch to a new user which has not had Nix installed, I'm able to build these without issue.
As an example,
{very long command invocation snipped}
/Users/paulcolusso/Developer/heartbeat/server2/target/debug/deps/libsqlx_macros-95911fe3462937f2.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
= note: ld: framework not found SystemConfiguration
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `sqlx-macros` due to previous error
I've discovered that the macOS SDK derivations do exist, such as the following from the nix discourse and adding darwin.apple_sdk.frameworks.SystemConfiguration
derivation does indeed resolve the issue. The question How can I make macOS frameworks available to clang in a Nix environment? also touches on this.
That being said, it is a little time consuming to slowly add each framework, as needed. Is there a way to install the entire apple_sdk
derivation into my home-manager or a nix-shell I can drop into? If not that, a way to escape out of the Nix sandbox without keeping another user account on hand?