正确地将 darwin.apple_sdk 添加到 nix-shell
Properly adding darwin.apple_sdk to a nix-shell
我已经 运行 解决过这些问题几次,但还没有找到解决方案。我的环境安装了 Xcode 命令行工具,但自安装 Nix 以来,Clang 一直难以找到 macOS SDK 框架。我知道这些都存在,就好像我切换到一个没有安装 Nix 的新用户一样,我可以毫无问题地构建它们。
例如,
{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
我发现确实存在macOS SDK派生,例如following from the nix discourse and adding darwin.apple_sdk.frameworks.SystemConfiguration
derivation does indeed resolve the issue. The question 也涉及到这一点。
话虽如此,根据需要慢慢添加每个框架还是有点耗时的。有没有办法将整个 apple_sdk
派生安装到我的家庭管理器或我可以放入的 nix-shell 中?如果不是那样,有一种方法可以在不保留另一个用户帐户的情况下逃离 Nix 沙箱吗?
Is there a way to install the entire apple_sdk derivation into my home-manager or a nix-shell I can drop into?
No/Yes。您可以编写一些代码来收集所有属性并添加它们,或者只是从 https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
复制它们
If not that, a way to escape out of the Nix sandbox without keeping another user account on hand?
您可以在 nix.conf
(https://nixos.org/manual/nix/stable/command-ref/conf-file.html#:~:text=Default%3A%20false-,sandbox,-If%20set%20to) 中使用 sandbox = false
禁用它,但请记住,这主要是未经测试的,并且在 linux 上有些东西只能构建在沙盒。
我已经 运行 解决过这些问题几次,但还没有找到解决方案。我的环境安装了 Xcode 命令行工具,但自安装 Nix 以来,Clang 一直难以找到 macOS SDK 框架。我知道这些都存在,就好像我切换到一个没有安装 Nix 的新用户一样,我可以毫无问题地构建它们。
例如,
{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
我发现确实存在macOS SDK派生,例如following from the nix discourse and adding darwin.apple_sdk.frameworks.SystemConfiguration
derivation does indeed resolve the issue. The question
话虽如此,根据需要慢慢添加每个框架还是有点耗时的。有没有办法将整个 apple_sdk
派生安装到我的家庭管理器或我可以放入的 nix-shell 中?如果不是那样,有一种方法可以在不保留另一个用户帐户的情况下逃离 Nix 沙箱吗?
Is there a way to install the entire apple_sdk derivation into my home-manager or a nix-shell I can drop into?
No/Yes。您可以编写一些代码来收集所有属性并添加它们,或者只是从 https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
复制它们If not that, a way to escape out of the Nix sandbox without keeping another user account on hand?
您可以在 nix.conf
(https://nixos.org/manual/nix/stable/command-ref/conf-file.html#:~:text=Default%3A%20false-,sandbox,-If%20set%20to) 中使用 sandbox = false
禁用它,但请记住,这主要是未经测试的,并且在 linux 上有些东西只能构建在沙盒。