Skip to content

Darwin cross pkgsBuildBuild/pkgsBuildHost evaluation regression #355622

@simonzkl

Description

@simonzkl

Describe the bug

The pkgsBuildHost.<x> and pkgsBuildBuild.<x> derivations evaluate differently when using a cross-compiling nixpkgs instance (darwin -> linux). This is expected for packages like pkg-config where host matters, but not for everything else (e.g. jq). The end result is that almost everything in nativeBuildInputs misses the binary cache and needs to be rebuilt. This could be fixed by moving these packages to depsBuildBuild, but this is a massive change both in nixpkgs and downstream projects.

This is a regression from nixos-24.05. It also works as expected when cross-compiling x86_64-linux -> aarch64-linux, so I think it's something specific to the darwin stdenv in unstable.

Steps To Reproduce

nix-repl> pkgs = import nixpkgs { system = "aarch64-darwin"; }
nix-repl> pkgsCross = import nixpkgs { system = "aarch64-darwin"; crossSystem = "aarch64-linux"; }

nix-repl> pkgs.jq
«derivation /nix/store/gsdqx9n5hclwkadf6hxhlqhd309sb3nn-jq-1.7.1.drv»

nix-repl> pkgsCross.pkgsBuildBuild.jq
«derivation /nix/store/gsdqx9n5hclwkadf6hxhlqhd309sb3nn-jq-1.7.1.drv»

nix-repl> pkgsCross.pkgsBuildHost.jq  
«derivation /nix/store/wxq745g9912lmyakff9mpmjnf3rx6dd3-jq-1.7.1.drv»

Expected behavior

nix-repl> pkgs = import nixpkgs { system = "aarch64-darwin"; }
nix-repl> pkgsCross = import nixpkgs { system = "aarch64-darwin"; crossSystem = "aarch64-linux"; }

nix-repl> pkgs.jq
«derivation /nix/store/gsdqx9n5hclwkadf6hxhlqhd309sb3nn-jq-1.7.1.drv»

nix-repl> pkgsCross.pkgsBuildBuild.jq
«derivation /nix/store/gsdqx9n5hclwkadf6hxhlqhd309sb3nn-jq-1.7.1.drv»

nix-repl> pkgsCross.pkgsBuildHost.jq  
«derivation /nix/store/gsdqx9n5hclwkadf6hxhlqhd309sb3nn-jq-1.7.1.drv»

Additional context

Nixpkgs revision: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2

Notify maintainers

@NixOS/darwin-team

Metadata

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.6.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/808lp63z6yiraikjpzcfk3xg1frpd2s0-source`

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken0.kind: regressionSomething that worked before working no longer2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used on6.topic: darwinRunning or building packages on Darwin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions