Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking: New Darwin SDK pattern migration #354146

Open
getchoo opened this issue Nov 7, 2024 · 5 comments
Open

Tracking: New Darwin SDK pattern migration #354146

getchoo opened this issue Nov 7, 2024 · 5 comments
Labels
5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: darwin Running or building packages on Darwin

Comments

@getchoo
Copy link
Member

getchoo commented Nov 7, 2024

Issue description

As introduced in #346043 and explained fully in https://discourse.nixos.org/t/the-darwin-sdks-have-been-updated/55295, nixpkgs has a new way of handling the Darwin SDK.

As a TL;DR:

  • Instead of providing separate SDK frameworks and libraries, they are bundled together in an SDK that can be used with xcrun and the xcbuild package.
  • The SDK includes everything you need to build applications. It also propagates certain packages automatically (libiconv, libresolv, and libsbuf). It is no longer necessary to include these conditionally on Darwin.
  • The stdenv provides a default SDK (the unversioned apple-sdk package). A different SDK can be used to change the SDK in use by adding it to your buildInputs (see the stdenv documentation for more details).

Some examples of the migration are:

  • Removing the following from packages when using the default (unversioned) SDK, as it is now in the Darwin stdenv
{
  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];
}
  • Moving versioned SDK frameworks and libraries to the apple-sdk_${version} pattern
{
  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
    darwin.apple_sdk_11_0.frameworks.Security
  ];
}
{
  buildInputs = lib.optional stdenv.hostPlatform.isDarwin apple-sdk_11;
}
  • Removing usages of overrideSDK and darwin.apple_sdk_11_0.callPackage

Steps to reproduce

You can grep for usages of the SDK and it's components tree-wide:

For example, to find files using it in pkgs/by-name:

$ grep -Rl 'darwin.apple_sdk' pkgs/by-name

You may also want to search for specific components, i.e.:

$ grep -Rl 'Security' pkgs/tools/audio

Technical details

Some caution should be taken during the migration:

@getchoo getchoo added 6.topic: darwin Running or building packages on Darwin 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems labels Nov 7, 2024
@emilazy
Copy link
Member

emilazy commented Nov 12, 2024

cc @NixOS/darwin-maintainers

@emilazy
Copy link
Member

emilazy commented Nov 12, 2024

Should probably mention that you also want to get rid of overrideSDK and darwin.apple_sdk_11_0.callPackage.

Also, re:

These issues will already be present. The new scheme is all that exists; the old stuff is just mostly‐inert shims. Doing the migration won’t break any package that wasn’t already broken (and will fix packages that were broken).

@isabelroses
Copy link
Member

isabelroses commented Nov 12, 2024

@getchoo re:

{
  buildInputs = lib.optional stdenv.hostPlatform.isDarwin apple-sdk_11;
}

It was mentioned in #353439 that is "no longer recommended to propagate an SDK in most circumstances."

Also very small typo you forgot the . between hostPlatform.isDarwin, also lowercase i for the isDarwin.

@emilazy
Copy link
Member

emilazy commented Nov 12, 2024

buildInputs doesn’t propagate anything.

getchoo added a commit to getchoo-contrib/nixpkgs that referenced this issue Nov 14, 2024
getchoo added a commit to getchoo-contrib/nixpkgs that referenced this issue Nov 14, 2024
getchoo added a commit to getchoo-contrib/nixpkgs that referenced this issue Nov 15, 2024
getchoo added a commit to getchoo-contrib/nixpkgs that referenced this issue Nov 16, 2024
@getchoo getchoo mentioned this issue Nov 16, 2024
13 tasks
@gepbird gepbird mentioned this issue Nov 16, 2024
13 tasks
github-actions bot pushed a commit that referenced this issue Nov 16, 2024
github-actions bot pushed a commit that referenced this issue Nov 17, 2024
itepastra added a commit to itepastra/nixpkgs that referenced this issue Nov 18, 2024
itepastra added a commit to itepastra/nixpkgs that referenced this issue Nov 18, 2024
itepastra added a commit to itepastra/nixpkgs that referenced this issue Nov 18, 2024
getchoo added a commit to getchoo-contrib/nixpkgs that referenced this issue Nov 19, 2024
Daru-san pushed a commit to Daru-san/nixpkgs that referenced this issue Nov 20, 2024
paschoal pushed a commit to paschoal/nixpkgs that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

3 participants