Skip to content

Comparison of nixpkgs.hostPlatform to nixpkgs.buildPlatform is flawed #278001

@jmbaur

Description

@jmbaur

Describe the bug

A clear and concise description of what the bug is.

When a nixos configuration has nixpkgs.hostPlatform and nixpkgs.buildPlatform both set to the same string, the module defined here always determines that the system is cross-compiled, even when it should not be.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Make a nixos config with the example configuration:
{ nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.buildPlatform = "x86_64-linux"; }
  1. Try building and notice that the entire world gets rebuilt since it tries to build cross-compilation toolchains

Expected behavior

A clear and concise description of what you expected to happen.

I would expect that the module would determine I am not cross-compiling the nixos system and build accordingly.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

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: `"x86_64-linux"`
 - host os: `Linux 6.6.8, NixOS, 24.05 (Uakari), 24.05.20231231.48d59d0`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/4pxqlm2rwq6j6di78q178602jfnx2mys-source`

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions