Skip to content

shell.nix outdated and failed on macOS: darwin.apple_sdk has been phased out. #1429

@Binlogo

Description

@Binlogo

Description

When attempting to build a Nix environment using ⁠nix-shell, the process fails with an error indicating that ⁠darwin.apple_sdk_11_0 has been removed. This appears to be due to a dependency in ⁠shell.nix that relies on this legacy SDK, which is no longer available in recent versions of Nixpkgs.

Steps to Reproduce

  1. Use a ⁠shell.nix file that depends on ⁠darwin.apple_sdk.
  2. Run ⁠nix-shell shell.nix on macOS, the build process will faild.
  System:
    OS: macOS 15.6
    CPU: (24) arm64 Apple M2 Ultra
    Memory: 627.47 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh

The command fails with the following error message:

❯ nix-shell shell.nix         
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/gjl3hj01mbjmfdcydcwbldh1jh6c53h8-nixos-21.11/pkgs/stdenv/generic/make-derivation.nix:205:7

       … while evaluating attribute 'buildInputs' of derivation 'nix-shell'
         at /nix/store/gjl3hj01mbjmfdcydcwbldh1jh6c53h8-nixos-21.11/pkgs/stdenv/generic/make-derivation.nix:247:7:
          246|       depsHostHost                = lib.elemAt (lib.elemAt dependencies 1) 0;
          247|       buildInputs                 = lib.elemAt (lib.elemAt dependencies 1) 1;
             |       ^
          248|       depsTargetTarget            = lib.elemAt (lib.elemAt dependencies 2) 0;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: darwin.apple_sdk_11_0 has been removed as it was a legacy compatibility stub; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin-legacy-frameworks> for migration instructions

###
Possible Solution
The error message points to the cause and solution. The dependencies need to be updated to no longer rely on the legacy ⁠apple_sdk_11_0. The migration instructions can be found in the Nixpkgs manual here: https://nixos.org/manual/nixpkgs/stable/#sec-darwin-legacy-frameworks
The ⁠shell.nix should be updated to use the current, recommended frameworks available in Nixpkgs for macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions