Skip to content

pkgsStatic.coreutils: error targetPackages.darwin.LibsystemCross x86_64-apple-darwin  #270375

@avdv

Description

@avdv

Describe the bug

Trying to use the pkgsStatic.coreutils package on x86_64 Darwin fails when using nixos-unstable:

error: don't yet have a `targetPackages.darwin.LibsystemCross for x86_64-apple-darwin`

(it works on aarch64-darwin)

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-shell --argstr localSystem x86_64-darwin -I nixpkgs=./. --show-trace -p pkgsStatic.coreutils
error:
       … while evaluating the attribute 'buildInputs' of the derivation 'shell'

       at /Users/claudio/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7:

          347|     // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          348|       name =
             |       ^
          349|         let

       … while evaluating the attribute 'NIX_CFLAGS_LINK' of the derivation 'coreutils-static-x86_64-apple-darwin-9.3'

       at /Users/claudio/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7:

          347|     // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          348|       name =
             |       ^
          349|         let

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/stdenv/adapters.nix:146:11:

          145|       NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "")
          146|         + lib.optionalString (stdenv.cc.isGNU or false) " -static-libgcc";
             |           ^
          147|       nativeBuildInputs = (finalAttrs.nativeBuildInputs or [])

       … while calling 'optionalString'

       at /Users/claudio/nixpkgs/lib/strings.nix:257:5:

          256|     # String to return if condition is true
          257|     string: if cond then string else "";
             |     ^
          258|

       … while evaluating the attribute 'cc.isGNU'

       at /Users/claudio/nixpkgs/pkgs/stdenv/generic/default.nix:165:14:

          164|
          165|       inherit cc hasCC;
             |              ^
          166|

       … while evaluating the attribute 'llvmPackages.libcxxClang'

       at /Users/claudio/nixpkgs/pkgs/development/compilers/llvm/16/default.nix:132:5:

          131|
          132|     libcxxClang = wrapCCWith rec {
             |     ^
          133|       cc = tools.clang-unwrapped;

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/development/compilers/llvm/16/default.nix:132:19:

          131|
          132|     libcxxClang = wrapCCWith rec {
             |                   ^
          133|       cc = tools.clang-unwrapped;

       … while calling 'wrapCCWith'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17387:5:

        17386|   wrapCCWith =
        17387|     { cc
             |     ^
        17388|     , # This should be the only bintools runtime dep with this sort of logic. The

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17406:7:

        17405|     } @ extraArgs:
        17406|       callPackage ../build-support/cc-wrapper (let self = {
             |       ^
        17407|     nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false;

       … while calling 'callPackageWith'

       at /Users/claudio/nixpkgs/lib/customisation.nix:141:35:

          140|   */
          141|   callPackageWith = autoArgs: fn: args:
             |                                   ^
          142|     let

       … while evaluating call site

       at /Users/claudio/nixpkgs/lib/customisation.nix:192:34:

          191|
          192|     in if missingArgs == [] then makeOverridable f allArgs else abort error;
             |                                  ^
          193|

       … while calling anonymous lambda

       at /Users/claudio/nixpkgs/lib/customisation.nix:84:17:

           83|     in
           84|     mirrorArgs (origArgs:
             |                 ^
           85|     let

       … while evaluating call site

       at /Users/claudio/nixpkgs/lib/customisation.nix:86:16:

           85|     let
           86|       result = f origArgs;
             |                ^
           87|

       … while calling anonymous lambda

       at /Users/claudio/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:8:1:

            7|
            8| { name ? ""
             | ^
            9| , lib

       … while evaluating the attribute 'libc'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17415:12:

        17414|
        17415|     inherit cc bintools libc libcxx extraPackages nixSupport zlib;
             |            ^
        17416|   } // extraArgs; in self);

       … while evaluating the attribute 'bintools'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:18669:3:

        18668|   };
        18669|   bintools = wrapBintoolsWith {
             |   ^
        18670|     bintools = bintools-unwrapped;

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:18669:14:

        18668|   };
        18669|   bintools = wrapBintoolsWith {
             |              ^
        18670|     bintools = bintools-unwrapped;

       … while calling 'wrapBintoolsWith'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17423:5:

        17422|   wrapBintoolsWith =
        17423|     { bintools
             |     ^
        17424|     , libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17427:7:

        17426|     } @ extraArgs:
        17427|       callPackage ../build-support/bintools-wrapper (let self = {
             |       ^
        17428|     nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false;

       … while calling 'callPackageWith'

       at /Users/claudio/nixpkgs/lib/customisation.nix:141:35:

          140|   */
          141|   callPackageWith = autoArgs: fn: args:
             |                                   ^
          142|     let

       … while evaluating call site

       at /Users/claudio/nixpkgs/lib/customisation.nix:192:34:

          191|
          192|     in if missingArgs == [] then makeOverridable f allArgs else abort error;
             |                                  ^
          193|

       … while calling anonymous lambda

       at /Users/claudio/nixpkgs/lib/customisation.nix:84:17:

           83|     in
           84|     mirrorArgs (origArgs:
             |                 ^
           85|     let

       … while evaluating call site

       at /Users/claudio/nixpkgs/lib/customisation.nix:86:16:

           85|     let
           86|       result = f origArgs;
             |                ^
           87|

       … while calling anonymous lambda

       at /Users/claudio/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix:8:1:

            7|
            8| { name ? ""
             | ^
            9| , lib

       … while evaluating the attribute 'libc'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:17434:12:

        17433|
        17434|     inherit bintools libc;
             |            ^
        17435|     inherit (darwin) postLinkSignHook signingUtils;

       … while evaluating call site

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:21644:69:

        21643|
        21644|   libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;
             |                                                                     ^
        21645|

       … while calling 'libcCrossChooser'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:21618:22:

        21617|   # We can choose:
        21618|   libcCrossChooser = name:
             |                      ^
        21619|     # libc is hackily often used from the previous stage. This `or`

       … while evaluating the attribute 'darwin.LibsystemCross'

       at /Users/claudio/nixpkgs/pkgs/top-level/all-packages.nix:27768:3:

        27767|   # `.override` clobbered. C.F. `llvmPackages` which does the same.
        27768|   darwin = recurseIntoAttrs (callPackage ./darwin-packages.nix { });
             |   ^
        27769|

       error: don't yet have a `targetPackages.darwin.LibsystemCross for x86_64-apple-darwin`

Expected behavior

We should be able to use pkgsStatic.coreutils on x86_64-darwin.

Additional context

I git bisected the problem to commit 42b5817 which actually introduced support for non-linux host platforms in the first place. This would probably mean that before this change package x and pkgsStatic.x would be exactly the same on Darwin?

We used the pkgsStatic.coreutils package from nixos-22.11 before, but ran into this problem after upgrading to nixos-unstable, see tweag/rules_nixpkgs#424

Notify maintainers

cc @uri-canva

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"

 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.6.0, macOS 12.7`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Priorities

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions